OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.robertl/] [eb27.C] - Blame information for rev 338

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 305 jeremybenn
// { dg-do assemble  }
2
// { dg-options "-Wno-deprecated" }
3
/* bug.cc */
4
/* simple program to demonstrate the bug with named return values in gcc
5
*/
6
/* (w) 4.9.97 by Kurt Garloff  */
7
// 8/28/1998 - This dies in add_conversions from dfs_walk, null CLASSTYPE_METHOD_VEC
8
// for the test record_type.  This is marked as an expected failure for now,
9
// until we actually fix it.
10
 
11
#include 
12
 
13
template  class test;
14
template  test operator + (const test& a, const test& b);
15
 
16
// A simple numerical class
17
template 
18
class test
19
{
20
   T elem;
21
 public:
22
   test ()  { elem = 0; };
23
   test (const T& a)  { elem = a; };
24
   test& operator += (const test& a)  { elem += a.elem; return *this; };
25
   friend test operator + <> (const test&, const test&);
26
   friend std::ostream& operator << (std::ostream& os, const test& a)
27
     { return os << a.elem; };
28
};
29
 
30
// named return value version
31
template 
32
test operator + (const test& a, const test& b) return c(a);// { dg-error "" } named return value
33
{ c += b; } // { dg-error "" } c undeclared
34
 
35
int main()
36
{
37
   test x, y;
38
   x += 5;
39
   std::cout << x << std::endl;
40
   y = x + test(2);
41
   std::cout << y << std::endl;
42
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.