[Bug c++/20408] Unnecessary code generated for empty structs

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Mar 10 17:06:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-03-10 17:06 -------
>From call.c:
  /* Don't pass empty class objects by value.  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.  */
  if (! decl || ! DECL_BUILT_IN (decl))
    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 = build0 (EMPTY_CLASS_EXPR, TREE_TYPE (TREE_VALUE (tmp)));
	  TREE_VALUE (tmp) = build2 (COMPOUND_EXPR, TREE_TYPE (t),
				     TREE_VALUE (tmp), t);
	}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20408



More information about the Gcc-bugs mailing list