diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1998-04-01 17:05:25 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1998-04-01 12:05:25 -0500 |
commit | 570221c20101ecc72f193e2b88e39069e05c963d (patch) | |
tree | c1e54f83c5989df56ecb7ded908c39c5421e4413 /gcc/cp/call.c | |
parent | 59581da6977aeae5819b43ebdd1eed1ee7f0d514 (diff) | |
download | gcc-570221c20101ecc72f193e2b88e39069e05c963d.zip gcc-570221c20101ecc72f193e2b88e39069e05c963d.tar.gz gcc-570221c20101ecc72f193e2b88e39069e05c963d.tar.bz2 |
friend.c (is_friend): Fix access control for local classes.
* friend.c (is_friend): Fix access control for local classes.
* class.c (is_empty_class): New fn.
* call.c (build_call): Don't pass empty class objects to a function.
From-SVN: r18933
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r-- | gcc/cp/call.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c index ab3e05e..dc5957d 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -24,11 +24,12 @@ Boston, MA 02111-1307, USA. */ /* High-level class interface. */ #include "config.h" -#include "tree.h" #include "system.h" +#include "tree.h" #include "cp-tree.h" #include "output.h" #include "flags.h" +#include "rtl.h" #include "obstack.h" #define obstack_chunk_alloc xmalloc @@ -492,6 +493,7 @@ build_call (function, result_type, parms) tree function, result_type, parms; { int is_constructor = 0; + tree tmp; function = build_addr_func (function); @@ -506,6 +508,20 @@ build_call (function, result_type, parms) && DECL_CONSTRUCTOR_P (TREE_OPERAND (function, 0))) is_constructor = 1; + /* Don't actually pass empty class objects to a function. This is useful + for tags in STL, which are used to control overload resolution. + We don't need to handle other cases of copying empty classes. */ + for (tmp = parms; tmp; tmp = TREE_CHAIN (tmp)) + if (is_empty_class (TREE_TYPE (TREE_VALUE (tmp))) + && ! TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (tmp)))) + { + tree t = make_node (RTL_EXPR); + TREE_TYPE (t) = TREE_TYPE (TREE_VALUE (tmp)); + RTL_EXPR_RTL (t) = const0_rtx; + RTL_EXPR_SEQUENCE (t) = NULL_RTX; + TREE_VALUE (tmp) = t; + } + function = build_nt (CALL_EXPR, function, parms, NULL_TREE); TREE_HAS_CONSTRUCTOR (function) = is_constructor; TREE_TYPE (function) = result_type; |