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