aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/typeck.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-04-09 04:28:33 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-04-09 04:28:33 +0000
commit3dbc07b651f517fa2d07de91473a30b4216d091b (patch)
tree6f1b0dea92e2a38ea78ec4706a12cc4f332eeedf /gcc/cp/typeck.c
parent4eaf5996ad3b761bfb2abd6d65f78b43c4f9a4e5 (diff)
downloadgcc-3dbc07b651f517fa2d07de91473a30b4216d091b.zip
gcc-3dbc07b651f517fa2d07de91473a30b4216d091b.tar.gz
gcc-3dbc07b651f517fa2d07de91473a30b4216d091b.tar.bz2
Under the new ABI, constructors don't return `this'.
* cp-tree.h (warn_reorder): Declare. (special_function_kind): New enum. (global_base_init_list): Remove declaration. (emit_base_init): Don't return a value. (check_base_init): Don't declare. (is_aggr_typedef): Likewise. * decl.c (check_special_function_return_type): New function. (return_types): Remove. (grokdeclarator): Use check_special_function_return_type. (start_function): Don't initialize ctor_label under the new ABI. (finish_construtor_body): Don't create a corresponding LABEL_STMT. * init.c (begin_init_stmts): Move to top of file. (finish_init_stmts): Likewise. (warn_reorder): Don't declare. (emit_base_init): Don't create a STMT_EXPR here. Don't return a value. (check_base_init): Remove. (is_aggr_typedef): Likewise. (build_new_1): Don't use the return value of a constructor. * semantics.c (setup_vtbl_ptr): Don't use the return value of emit_base_init. * typeck.c (check_return_expr): Don't magically convert return statements into `return this' in constructors under the new ABI. From-SVN: r33035
Diffstat (limited to 'gcc/cp/typeck.c')
-rw-r--r--gcc/cp/typeck.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 74f16b7..bce12ad 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6796,9 +6796,9 @@ check_return_expr (retval)
/* You can't return a value from a constructor. */
error ("returning a value from a constructor");
- /* Constructors actually always return `this', even though in C++
- you can't return a value from a constructor. */
- if (DECL_CONSTRUCTOR_P (current_function_decl))
+ /* Under the old ABI, constructors actually always return `this',
+ even though in C++ you can't return a value from a constructor. */
+ if (!flag_new_abi && DECL_CONSTRUCTOR_P (current_function_decl))
retval = current_class_ptr;
/* When no explicit return-value is given in a function with a named