Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.ext/namedret2.C

raw
1 // { dg-do assemble { target alpha*-*-* } }
2 // { dg-options "-Wno-deprecated" }
3
4 // This test verifies that return type promotion is working correctly.
5 // The Alpha ABI specifies that 32-bit return values have bit 31 propagated,
6 // i.e. the value is sign-extended even if the unpromoted type is unsigned.
7
8 unsigned int f(unsigned int x) return y(x) { return 0; } // { dg-error "" }
9
10 extern "C" void abort ();
11
12 int main()
13 {
14 typedef long (*long_func)(long);
15 long_func g = reinterpret_cast<long_func>(f);
16
17 if (g(-1L) != -1L)
18 abort ();
19 return 0;
20 }