PR c++/66542
* decl.c (expand_static_init): Make sure the destructor is callable
here even if we have an initializer.
From-SVN: r224842
+2015-06-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/66542
+ * decl.c (expand_static_init): Make sure the destructor is callable
+ here even if we have an initializer.
+
2015-06-04 Pierre-Marie de Rodat <derodat@adacore.com>
* lang-specs.h: Pass "-o %g.s" to cc1plus for headers even if
gcc_assert (TREE_STATIC (decl));
/* Some variables require no dynamic initialization. */
- if (!init
- && TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
+ if (TYPE_HAS_TRIVIAL_DESTRUCTOR (TREE_TYPE (decl)))
{
/* Make sure the destructor is callable. */
cxx_maybe_build_cleanup (decl, tf_warning_or_error);
- return;
+ if (!init)
+ return;
}
if (DECL_THREAD_LOCAL_P (decl) && DECL_GNU_TLS_P (decl)
--- /dev/null
+// PR c++/66542
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ A() {}
+ ~A() = delete; // { dg-message "declared here" }
+};
+
+static A a; // { dg-error "deleted" }