PR c++/12519
* c-semantics.c (genrtl_cleanup_stmt): Ignore the CLEANUP_DECL if
it isn't a decl.
From-SVN: r72206
+2003-10-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/12519
+ * c-semantics.c (genrtl_cleanup_stmt): Ignore the CLEANUP_DECL if
+ it isn't a decl.
+
2003-10-07 Alexandre Oliva <aoliva@redhat.com>
* gcc.c (cpp_options): Only pass -fworking-directory for -g* if
genrtl_cleanup_stmt (tree t)
{
tree decl = CLEANUP_DECL (t);
- if (!decl || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
+ if (!decl || !DECL_P (decl)
+ || (DECL_SIZE (decl) && TREE_TYPE (decl) != error_mark_node))
expand_decl_cleanup_eh (decl, CLEANUP_EXPR (t), CLEANUP_EH_ONLY (t));
}
--- /dev/null
+// PR c++/12519
+
+// { dg-do compile }
+// { dg-options "-O" }
+
+struct A
+{
+ ~A();
+};
+
+inline const A foo()
+{
+ A a;
+ return a;
+}
+
+A bar()
+{
+ return foo();
+}