diff options
-rw-r--r-- | gcc/cp/typeck.cc | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wignored-qualifiers2.C | 17 |
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/typeck.cc b/gcc/cp/typeck.cc index 11c9d8a..50d04c1 100644 --- a/gcc/cp/typeck.cc +++ b/gcc/cp/typeck.cc @@ -9593,7 +9593,9 @@ build_ptrmemfunc (tree type, tree pfn, int force, bool c_cast_p, /* Handle null pointer to member function conversions. */ if (null_ptr_cst_p (pfn)) { - pfn = cp_build_c_cast (input_location, type, pfn, complain); + pfn = cp_build_c_cast (input_location, + TYPE_PTRMEMFUNC_FN_TYPE_RAW (to_type), + pfn, complain); return build_ptrmemfunc1 (to_type, integer_zero_node, pfn); diff --git a/gcc/testsuite/g++.dg/warn/Wignored-qualifiers2.C b/gcc/testsuite/g++.dg/warn/Wignored-qualifiers2.C new file mode 100644 index 0000000..c4c3754 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wignored-qualifiers2.C @@ -0,0 +1,17 @@ +// PR c++/92752 +// { dg-do compile } +// { dg-additional-options "-Wignored-qualifiers" } + +struct X; + +template<class T> +struct Wrap { + T data; + Wrap() : data() {} +}; + +typedef int (X::*type)(); +Wrap<const type> x; +#if __cpp_initializer_lists +const type t{}; +#endif |