Commit 550d1bf4 by Mark Mitchell Committed by Mark Mitchell

re PR c++/21347 (spurious warning with -Wctor-dtor-privacy)

	PR c++/21347
	* class.c (maybe_warn_about_overly_private_class): Lazy
	constructors are public.
	PR c++/21347
	* g++.dg/warn/Wctor-dtor.C: New test.

From-SVN: r105441
parent b27cedc6
2005-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/21347
* class.c (maybe_warn_about_overly_private_class): Lazy
constructors are public.
2005-10-14 Mark Mitchell <mark@codesourcery.com>
PR c++/19565
......
......@@ -1537,7 +1537,10 @@ maybe_warn_about_overly_private_class (tree t)
return;
}
if (TYPE_HAS_CONSTRUCTOR (t))
if (TYPE_HAS_CONSTRUCTOR (t)
/* Implicitly generated constructors are always public. */
&& (!CLASSTYPE_LAZY_DEFAULT_CTOR (t)
|| !CLASSTYPE_LAZY_COPY_CTOR (t)))
{
int nonprivate_ctor = 0;
......
2005-10-15 Mark Mitchell <mark@codesourcery.com>
PR c++/21347
* g++.dg/warn/Wctor-dtor.C: New test.
2005-10-14 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/23439
// PR c++/21347
// { dg-options "-Wctor-dtor-privacy" }
class A {
public:
int x;
int getX() { return x; } // comment out to avoid warning
};
int foo() {
A a; // accepted: clearly the ctor is not private
return a.x;
}
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