c++/5340: compilation problem

jianhua.zhou@informix.com jianhua.zhou@informix.com
Wed Jan 9 15:56:00 GMT 2002


>Number:         5340
>Category:       c++
>Synopsis:       compilation problem
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 09 15:56:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Jianhua Zhou
>Release:        g++ 2.9.6
>Organization:
>Environment:
RedHat 7.1
>Description:
Compile this program with g++ 2.9.6 and on RedHat 7.1 gives an error to me.
This file can be compile and linked on RedHat Linux 6.2,
which have the "g++" 2.9.1.

#include <iostream.h>

class Param
{
public:
   Param( int v) { value = v ; } ;

   int value ;
};

class Test
{
public:
    static int myFunc( const Param& k ) { return k.value ; };
    static int myFunc( const int& k ) { return k ; };
} ;

static  int sfunc( int(*f)(const Param& k), const Param &t )
{
    return (*f)( t) ;
}

int
main()
{
    int ret ;
    Param param(11) ;

    ret = sfunc( Test::myFunc, Param(12)) ;

    cout << "ret=" << ret << endl ;

    return 0 ;
}

This file is ok on 3.0.3. But we 3.0.3 is ANSI C++ standard
version, and we are using some features which ANSI C++ no longer supported. So we have to use g++ 2.9.X version.

Thanks!

>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-prs mailing list