PR c++/31165
* call.c (convert_default_arg): Instead of copying the node,
unshare it.
2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR C++/31165
* g++.dg/other/default7.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122941
138bc75d-0d04-0410-961f-
82ee72b054a4
+2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR c++/31165
+ * call.c (convert_default_arg): Instead of copying the node,
+ unshare it.
+
2007-03-15 Dirk Mueller <dmueller@suse.de>
PR c++/30860
VAR_DECL. We can avoid the copy for constants, since they
are never modified in place. */
if (!CONSTANT_CLASS_P (arg))
- arg = copy_node (arg);
+ arg = unshare_expr (arg);
arg = convert_for_initialization (0, type, arg, LOOKUP_NORMAL,
"default argument", fn, parmnum);
arg = convert_for_arg_passing (type, arg);
+2007-03-14 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ PR C++/31165
+ * g++.dg/other/default7.C: New test.
+
2007-03-15 Dirk Mueller <dmueller@suse.de>
* g++.dg/warn/Wconversion2.C: New.
--- /dev/null
+/* { dg-do assemble } */
+/* { dg-options "-O1" }*/
+// This was PR C++/31165
+// We used to copy the whole decl when we just wantted to
+// unshare some expressions for the default argument.
+class string {
+ char *ptr;
+ int len;
+ int sz;
+};
+class cset { } _cset_init;
+string an_empty_string;
+void f(string& = an_empty_string);
+void
+h (void )
+{
+f();
+}
+
+