diff options
author | Jason Merrill <jason@redhat.com> | 2017-06-18 00:25:15 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-06-18 00:25:15 -0400 |
commit | 5ebcc5477a59dbe51c7e1130a2b751a2a1d89574 (patch) | |
tree | 168d552a3d488de5b1d9debb8a918f975d0e69c5 /gcc | |
parent | 28ab5c5ea9510b1937d4bd0e9343372d67f83610 (diff) | |
download | gcc-5ebcc5477a59dbe51c7e1130a2b751a2a1d89574.zip gcc-5ebcc5477a59dbe51c7e1130a2b751a2a1d89574.tar.gz gcc-5ebcc5477a59dbe51c7e1130a2b751a2a1d89574.tar.bz2 |
PR c++/70844 - -Wuseless-cast and inheriting constructor.
* method.c (forward_parm): Suppress warn_useless_cast.
From-SVN: r249344
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/method.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/inh-ctor27.C | 13 |
3 files changed, 19 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dba5e4d..d082574 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-06-17 Jason Merrill <jason@redhat.com> + + PR c++/70844 - -Wuseless-cast and inheriting constructor. + * method.c (forward_parm): Suppress warn_useless_cast. + 2017-06-16 Jason Merrill <jason@redhat.com> PR c++/81045 - Wrong type-dependence with auto return type. diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 9541fcb..fe4b2af 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 0000000..ef2ada1 --- /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); |