On 7/16/24 12:18 PM, Andi Kleen wrote:
On Tue, Jul 16, 2024 at 11:17:14AM -0400, Jason Merrill wrote:
On 7/16/24 11:15 AM, Andi Kleen wrote:
In the adjusted test it looks like the types of f and g match, so I wouldn't
expect an error.
Good point! Missing the forest for the trees.
Anyways are the C++ patches ok with this change?
I'm still looking for a test which does error because the types are
different.
Like this?
Where the called function returns C and the callee function does not.
-Andi
diff --git a/gcc/testsuite/g++.dg/musttail10.C
b/gcc/testsuite/g++.dg/musttail10.C
index 6a8507784a14..e454a6238a06 100644
--- a/gcc/testsuite/g++.dg/musttail10.C
+++ b/gcc/testsuite/g++.dg/musttail10.C
@@ -4,7 +4,7 @@
template <class T> T f();
-double h() { [[gnu::musttail]] return f<int>(); } /* { dg-error "cannot tail-call" } */
+double g() { [[gnu::musttail]] return f<int>(); } /* { dg-error "cannot
tail-call" } */
template <class T>
__attribute__((noinline, noclone, noipa))
@@ -18,6 +18,10 @@ template <class T>
__attribute__((noinline, noclone, noipa))
T g3() { [[gnu::musttail]] return f<T>(); }
+template <class T>
+__attribute__((noinline, noclone, noipa))
+T g4() { [[gnu::musttail]] return f<double>(); } /* { dg-error "cannot
tail-call" } */
+
class C
{
double x;
@@ -31,4 +35,5 @@ int main()
g1<int>();
g2<double>();
g3<C>();
+ g4<int>();
}