Hallo DIGITAL UNIX gurus,
first I must say, that I'm not a C++ expert, but our students have
problems with a software package, which compiles without problems on IBM,
HP and SUN Workstations under vendor compilers but does not compile on
DIGITAL's CXX.
I'm using CXX version 5.5 under DU4.0b. (BTW: CXX5.6 shows similar output)
May be that there are problems with pointers to _elementfunctions_.
Here are some examples of one of our students to demonstrate the errors:
******** simple1.cc ******************************************************
class A
{
public:
typedef int (A:: *Ptr)(void);
A () { bar (foo); }
int foo (void);
void bar (Ptr p);
};
======== cxx -c simple1.cc ===============================================
cxx: Error: simple1.cc, line 8: In this statement, member "A::foo" is
referenced without an object.
A () { bar (foo); }
--------------^
******** simple2.cc ******************************************************
class A
{
public:
typedef int (A:: *Ptr)(void);
A () { bar (this->foo); }
int foo (void);
void bar (Ptr p);
};
======== cxx -c simple2.cc ===============================================
cxx: Warning: simple2.cc, line 8: In this statement, "this->foo" refers to
a member function in a context other than as the target of an invocation.
A () { bar (this->foo); }
--------------^
cxx: Error: simple2.cc, line 8: In this statement, "this->foo" is of type
"pointer to function () returning int", and may not be converted to
"pointer to function () returning int member of A".
A () { bar (this->foo); }
--------------^
******** simple3.cc ******************************************************
class A
{
public:
typedef int (A:: *Ptr) (void);
Ptr foo;
Ptr function (void);
Ptr bar (void) { return (foo != 0) ? foo : function (); }
};
======== cxx -c simple3.cc ===============================================
cxx: Error: simple3.cc, line 11: In this statement, "foo" and "function()"
may not be combined in a conditional expression.
Ptr bar (void) { return (foo != 0) ? foo : function (); }
--------------------------^
******** simple4.cc ******************************************************
class A
{
public:
typedef int (A:: *Ptr)(void);
Ptr foo;
Ptr bar (void) { if (foo) return foo; else return 0; }
};
======== cxx -c simple4.cc ===============================================
cxx: Error: simple4.cc, line 10: The controlling expression "foo" has a
pointer to member type, which is not scalar.
Ptr bar (void) { if (foo) return foo; else return 0; }
-----------------------^
Note, on AIX4.2 these little programms compile without errors.
Any help will be wellcome.
Thanks in advance and have a nice day,
Rainer
| R.Schwierz_at_physik.tu-dresden.de |
| Rainer Schwierz, Inst. f. Kern- und Teilchenphysik |
| TU Dresden, D-01062 Dresden |
| Tel. ++49 351 463 2957 FAX ++49 351 463 3114 |
|
http://hep.phy.tu-dresden.de/~schwierz/ |
Received on Tue Nov 04 1997 - 09:16:34 NZDT