Commit 4514a96b by Jason Merrill Committed by Jason Merrill

c.opt (Winherited-variadic-ctor): New.

c-family/
	* c.opt (Winherited-variadic-ctor): New.
cp/
	* class.c (one_inherited_ctor): Warn about variadic inherited ctor.

From-SVN: r192811
parent dc6a6f61
2012-10-25 Jason Merrill <jason@redhat.com>
* c.opt (Winherited-variadic-ctor): New.
2012-10-25 Marc Glisse <marc.glisse@inria.fr> 2012-10-25 Marc Glisse <marc.glisse@inria.fr>
PR c++/54427 PR c++/54427
......
...@@ -426,6 +426,10 @@ Warn when a declaration does not specify a type ...@@ -426,6 +426,10 @@ Warn when a declaration does not specify a type
Wimport Wimport
C ObjC C++ ObjC++ Undocumented Ignore C ObjC C++ ObjC++ Undocumented Ignore
Winherited-variadic-ctor
C++ ObjC++ Var(warn_inh_var_ctor) Init(1) Warning
Warn about C++11 inheriting constructors when the base has a variadic constructor
Wint-to-pointer-cast Wint-to-pointer-cast
C ObjC C++ ObjC++ Var(warn_int_to_pointer_cast) Init(1) Warning C ObjC C++ ObjC++ Var(warn_int_to_pointer_cast) Init(1) Warning
Warn when there is a cast to a pointer from an integer of a different size Warn when there is a cast to a pointer from an integer of a different size
......
2012-10-25 Jason Merrill <jason@redhat.com>
* class.c (one_inherited_ctor): Warn about variadic inherited ctor.
2012-10-25 Marc Glisse <marc.glisse@inria.fr> 2012-10-25 Marc Glisse <marc.glisse@inria.fr>
PR c++/54427 PR c++/54427
......
...@@ -2807,6 +2807,12 @@ one_inherited_ctor (tree ctor, tree t) ...@@ -2807,6 +2807,12 @@ one_inherited_ctor (tree ctor, tree t)
new_parms[i++] = TREE_VALUE (parms); new_parms[i++] = TREE_VALUE (parms);
} }
one_inheriting_sig (t, ctor, new_parms, i); one_inheriting_sig (t, ctor, new_parms, i);
if (parms == NULL_TREE)
{
warning (OPT_Winherited_variadic_ctor,
"the ellipsis in %qD is not inherited", ctor);
inform (DECL_SOURCE_LOCATION (ctor), "%qD declared here", ctor);
}
} }
/* Create default constructors, assignment operators, and so forth for /* Create default constructors, assignment operators, and so forth for
......
...@@ -4632,6 +4632,13 @@ cases where multiple declaration is valid and changes nothing. ...@@ -4632,6 +4632,13 @@ cases where multiple declaration is valid and changes nothing.
@opindex Wno-nested-externs @opindex Wno-nested-externs
Warn if an @code{extern} declaration is encountered within a function. Warn if an @code{extern} declaration is encountered within a function.
@item -Wno-inherited-variadic-ctor
@opindex Winherited-variadic-ctor
@opindex Wno-inherited-variadic-ctor
Suppress warnings about use of C++11 inheriting constructors when the
base class inherited from has a C variadic constructor; the warning is
on by default because the ellipsis is not inherited.
@item -Winline @item -Winline
@opindex Winline @opindex Winline
@opindex Wno-inline @opindex Wno-inline
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
struct A struct A
{ {
A(int, ...); A(int, ...); // { dg-message "declared here" }
}; };
struct B: A struct B: A
{ {
using A::A; using A::A; // { dg-warning "ellipsis" }
}; };
B b1(42); B b1(42);
......
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