Commit 9f119e29 by Marek Polacek Committed by Marek Polacek

PR c++/90884 - stray note with -Wctor-dtor-privacy.

	* class.c (maybe_warn_about_overly_private_class): Guard the call to
	inform.

	* g++.dg/warn/ctor-dtor-privacy-4.C: New.
	* g++.dg/warn/ctor-dtor-privacy-4.h: New.

From-SVN: r272291
parent b27c1082
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-06-12 Jason Merrill <jason@redhat.com>
PR c++/85552 - wrong instantiation of dtor for DMI.
......
......@@ -2150,10 +2150,10 @@ maybe_warn_about_overly_private_class (tree t)
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);
......
2019-06-14 Marek Polacek <polacek@redhat.com>
PR c++/90884 - stray note with -Wctor-dtor-privacy.
* g++.dg/warn/ctor-dtor-privacy-4.C: New.
* g++.dg/warn/ctor-dtor-privacy-4.h: New.
2019-06-14 Richard Biener <rguenther@suse.de>
* gcc.dg/tree-ssa/ldist-26.c: Adjust.
......
// 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" }
#pragma GCC system_header
namespace std {
struct __nonesuch {
__nonesuch(__nonesuch const &);
};
} // namespace std
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment