aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2024-06-28 19:45:21 -0400
committerPatrick Palka <ppalka@redhat.com>2024-06-28 19:45:21 -0400
commit50073ffae0a9b8feb9b36fdafdebd9885f6d7dc8 (patch)
tree7a6bc31d27752f9c60ea7cf70834e422d0f3a3b1 /gcc/testsuite/g++.dg
parent52370c839edd04df86d3ff2b71fcdca0c7376a7f (diff)
downloadgcc-50073ffae0a9b8feb9b36fdafdebd9885f6d7dc8.zip
gcc-50073ffae0a9b8feb9b36fdafdebd9885f6d7dc8.tar.gz
gcc-50073ffae0a9b8feb9b36fdafdebd9885f6d7dc8.tar.bz2
c++: bad 'this' conversion for nullary memfn [PR106760]
Here we notice the 'this' conversion for the call f<void>() is bad, so we correctly defer deduction for the template candidate, but we end up never adding it to 'bad_cands' since missing_conversion_p for it returns false (its only argument is 'this' which has already been determined to be bad). This is not a huge deal, but it causes us to longer accept the call with -fpermissive in release builds, and a tree check ICE in checking builds. So if we have a non-strictly viable template candidate that has not been instantiated, then we need to add it to 'bad_cands' even if no argument conversion is missing. PR c++/106760 gcc/cp/ChangeLog: * call.cc (add_candidates): Relax test for adding a candidate to 'bad_cands' to also accept an uninstantiated template candidate that has no missing conversions. gcc/testsuite/ChangeLog: * g++.dg/ext/conv3.C: New test. Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r--gcc/testsuite/g++.dg/ext/conv3.C13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/ext/conv3.C b/gcc/testsuite/g++.dg/ext/conv3.C
new file mode 100644
index 0000000..7324d56
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/conv3.C
@@ -0,0 +1,13 @@
+// PR c++/106760
+// { dg-additional-options "-fpermissive" }
+
+struct S {
+ template<class> int f();
+ template<class> int g(...);
+};
+
+int main() {
+ const S s;
+ s.f<void>(); // { dg-warning "discards qualifiers" }
+ s.g<void>(); // { dg-warning "discards qualifiers" }
+}