From: Rainer Schwierz <schwierz () pktw03 ! phy ! tu-dresden ! de>
To: tru64-unix-managers
Subject: CXX question
Date: Tue, 04 Nov 1997 07:35:07 +0000 [thread overview]
Message-ID: <96078619210223.tru64-unix-managers.marc@archive.invalid> (raw)
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@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/ |
reply other threads:[~1997-11-04 7:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox