* class.c (maybe_warn_about_overly_private_class): Guard the call to
inform.
From-SVN: r274547
* decl.c (check_default_argument): Don't return nullptr when the arg
has side-effects.
+ 2019-06-14 Marek Polacek <polacek@redhat.com>
+
+ PR c++/90884 - stray note with -Wctor-dtor-privacy.
+ * class.c (maybe_warn_about_overly_private_class): Guard the call to
+ inform.
+
2019-08-14 Martin Sebor <msebor@redhat.com>
Backported from mainline
if (!nonprivate_ctor)
{
- warning (OPT_Wctor_dtor_privacy,
- "%q#T only defines private constructors and has no friends",
- t);
- if (copy_or_move)
+ bool w = warning (OPT_Wctor_dtor_privacy,
+ "%q#T only defines private constructors and has "
+ "no friends", t);
+ if (w && copy_or_move)
inform (DECL_SOURCE_LOCATION (copy_or_move),
"%q#D is public, but requires an existing %q#T object",
copy_or_move, t);
--- /dev/null
+// PR c++/90884
+// { dg-options "-Wctor-dtor-privacy" }
+// { dg-prune-output "In file included from" }
+
+#include "ctor-dtor-privacy-4.h" // { dg-bogus "is public" }
--- /dev/null
+#pragma GCC system_header
+
+namespace std {
+struct __nonesuch {
+ __nonesuch(__nonesuch const &);
+};
+} // namespace std