Add an UNSPEC_PROLOGUE_USE to prevent the link register from being considered dead.
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.law / cvt12.C
blob8455fac8b2b8e7628b58e681e121c31934997979
1 // GROUPS passed conversions
2 // cvt file
3 // Message-Id: <9301071708.AA03432@muresh.et.tudelft.nl>
4 // From: stravers@muresh.et.tudelft.nl (Paul Stravers)
5 // Subject: conversion method never called
6 // Date: Thu, 7 Jan 93 18:08:33 +0100
8 #include <stdio.h>
10 class test
12    double d;
13    int    i;
14 public:
15    test(double dd,int ii) {d=dd; i=ii;} // constructor
16    operator int&()        {return i;} // define a conversion from test to int&
17    int& geti()            {return i;} // same thing, but different
20 int main()
22    test t(3.14, 5);  // Create an object t of class "test"
23    int x = (int&)t;  // This should call operator int&() but it does not ...
24    int y = t.geti(); // x and y should both be 5 ...
25    if (x == 5 && y == 5)
26      printf ("PASS\n");
27    else
28      { printf ("FAIL\n"); return 1; }