Debian Codegraph @

gcc/testsuite/g++.old-deja/g++.pt/crash68.C

raw
1 // { dg-do assemble }
2 // { dg-prune-output "mangled name" }
3 // { dg-skip-if "requires hosted libstdc++ for iostream" { ! hostedlib } }
4 //
5 // Copyright (C) 2001 Free Software Foundation, Inc.
6 // Contributed by Nathan Sidwell 25 Jul 2001 <[email protected]>
7
8 // Origin: [email protected]
9 // Bug 3624. Template instantiation of a reference type was not
10 // converted from reference when doing a call.
11
12 #include <iostream>
13
14 using namespace std;
15
16 template <class A, class B, class C, C& c, bool d> class eo: public A
17 {
18 public:
19 eo()
20 {
21 cout << this->x << " " << this->y << " "
22 << c(*this) << " "
23 << ((d)?"true":"false") << endl;
24 }
25
26 private:
27 B b;
28 };
29
30 struct XY
31 {
32 float x, y;
33
34 XY(): x(1), y(0.1) {}
35 };
36
37 float fitness(const XY& a)
38 {
39 return a.x + a.y;
40 }
41
42 struct fitness2
43 {
44 float operator()(const XY& a)
45 {
46 return a.x - a.y;
47 }
48
49 float f(const XY& a)
50 {
51 return a.x - a.y;
52 }
53 };
54
55 struct fitness3
56 {
57 float operator()(const XY& a)
58 {
59 return a.x / a.y;
60 }
61 };
62
63 fitness2 f2;
64 fitness3 f3;
65
66 int main()
67 {
68 eo<XY, float, fitness2, f2, true> eo2;
69 eo<XY, float, fitness3, f3, true> eo3;
70
71 return 0;
72 }