From 62ecd2b8d46aaf96caef5fa78953216629e49ebd Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Fri, 13 May 2022 19:45:03 -0400 Subject: [PATCH] c++: Add fixed test [PR81952] This was fixed by r258755: PR c++/81311 - wrong C++17 overload resolution. PR c++/81952 gcc/testsuite/ChangeLog: * g++.dg/overload/conv-op4.C: New test. --- gcc/testsuite/g++.dg/overload/conv-op4.C | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 gcc/testsuite/g++.dg/overload/conv-op4.C diff --git a/gcc/testsuite/g++.dg/overload/conv-op4.C b/gcc/testsuite/g++.dg/overload/conv-op4.C new file mode 100644 index 00000000000..80de19549e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/overload/conv-op4.C @@ -0,0 +1,22 @@ +// PR c++/81952 +// { dg-do run { target c++11 } } + +template +struct opt { + opt() { } + opt(opt const& ) { __builtin_abort (); } + opt(opt&& ) { __builtin_abort (); } + + template + opt(U&& ) { } +}; + +struct foo +{ + explicit operator opt() { __builtin_abort (); return {}; } +}; + +int main() +{ + opt o(foo{}); +}