From: Jason Merrill Date: Sun, 18 Jun 2017 04:25:15 +0000 (-0400) Subject: PR c++/70844 - -Wuseless-cast and inheriting constructor. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5ebcc5477a59dbe51c7e1130a2b751a2a1d89574;p=gcc.git PR c++/70844 - -Wuseless-cast and inheriting constructor. * method.c (forward_parm): Suppress warn_useless_cast. From-SVN: r249344 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dba5e4d0ddb..d0825743e45 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-06-17 Jason Merrill + + PR c++/70844 - -Wuseless-cast and inheriting constructor. + * method.c (forward_parm): Suppress warn_useless_cast. + 2017-06-16 Jason Merrill PR c++/81045 - Wrong type-dependence with auto return type. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 9541fcb9161..fe4b2afe7db 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -486,6 +486,7 @@ forward_parm (tree parm) type = PACK_EXPANSION_PATTERN (type); if (TREE_CODE (type) != REFERENCE_TYPE) type = cp_build_reference_type (type, /*rval=*/true); + warning_sentinel w (warn_useless_cast); exp = build_static_cast (type, exp, tf_warning_or_error); if (DECL_PACK_P (parm)) exp = make_pack_expansion (exp); diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor27.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor27.C new file mode 100644 index 00000000000..ef2ada17d51 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor27.C @@ -0,0 +1,13 @@ +// PR c++/70844 +// { dg-options -Wuseless-cast } +// { dg-do compile { target c++11 } } + +struct base { + base (int const &); +}; + +struct derived : public base { + using base::base; +}; + +derived d(0);