summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.ext/namedret2.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.ext/namedret2.C20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C b/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C
new file mode 100644
index 000000000..339fc11e2
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.ext/namedret2.C
@@ -0,0 +1,20 @@
+// { dg-do assemble { target alpha*-*-* } }
+// { dg-options "-Wno-deprecated" }
+
+// This test verifies that return type promotion is working correctly.
+// The Alpha ABI specifies that 32-bit return values have bit 31 propagated,
+// i.e. the value is sign-extended even if the unpromoted type is unsigned.
+
+unsigned int f(unsigned int x) return y(x) { } // { dg-error "" }
+
+extern "C" void abort ();
+
+int main()
+{
+ typedef long (*long_func)(long);
+ long_func g = reinterpret_cast<long_func>(f);
+
+ if (g(-1L) != -1L)
+ abort ();
+ return 0;
+}