* decl.c (cxx_maybe_build_cleanup): Call mark_used.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207236
138bc75d-0d04-0410-961f-
82ee72b054a4
+2014-01-29 Jason Merrill <jason@redhat.com>
+
+ PR c++/59315
+ * decl.c (cxx_maybe_build_cleanup): Call mark_used.
+
2014-01-29 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/58702
destructor call instead. */
if (cleanup != NULL && EXPR_P (cleanup))
SET_EXPR_LOCATION (cleanup, UNKNOWN_LOCATION);
+
+ if (cleanup
+ && !lookup_attribute ("warn_unused", TYPE_ATTRIBUTES (TREE_TYPE (decl))))
+ /* Treat objects with destructors as used; the destructor may do
+ something substantive. */
+ mark_used (decl);
+
return cleanup;
}
// { dg-do compile }
-// { dg-options "-Wunused -O" }
+// { dg-options "-Wunused -O -fno-use-cxa-atexit" }
void do_cleanups();