Topic: Watcom C++ 10.0 bugs / standard issues


Author: robert@idt.unit.no (Robert Schmidt)
Date: 27 Jul 1994 13:00:24 GMT
Raw View
(Followup-To: comp.lang.c++)

I have encountered the following bugs in Watcom C++ 10.0.   They are both
related to pointers to members and their usage.  If I'm, in some sense, wrong
about this, please let me know.  Both examples compile fine with Borland C++
3.1 and 4.0.

I hope you standards people will bear with me, but I find the ARM a little
fuzzy about this, especially about the first bug.

So, I'm wondering who got the standard wrong: Borland and me, or Watcom... ;-)


1)

A pointer to member is not allowed as a value parameter to a (class)
template.  Example:

----------TEST1.CPP
struct A { int i; };

template <int A::* p> // fails!
struct B {
  // ...
};

main() {
  A a;
  B<&A::i> b;
}
----------

This error was reported:

TEST1.CPP(3): Error! E012: (col 22) template argument cannot be type 'int A::*'

The ARM says that a template-argument can be any argument-declaration, which
apparently includes pointers to members.  By the way - will explicit
function template arguments be included in the standard soon?



2)

Dereferencing a pointer to a member in an assignment statement is detected
as en error.  This example presents the bug, and a simple work-around:

----------TEST2.CPP
main() {
  struct A { int i; };
  A o, *p=&o;
  int A::* mp = &A::i;

  o.*mp = 1; // fails!
  p->*mp = 1; // fails!

  (o.*mp) = 1; // works
  (p->*mp) = 1; // works
}
----------

The two errors are reported as follows:

TEST2.CPP(6): Error! E006: (col 12) syntax error; probable cause: missing ';'
TEST2.CPP(7): Error! E006: (col 13) syntax error; probable cause: missing ';'

To me, this is obviously not correct.


I'd appreciate any feed-back on this.  I'd especially like to know if there
is a distribution ftp site for patches related to Watcom products.  WHELP
always crashes on me with a page fault.  I got it working by NOPing out
the offending instruction, but then the font looked a little weird.  So
I'd really like an official fix.

--
Robert Schmidt - robert@stud.unit.no

        If all you have is a hammer, everything looks like a nail.






Author: bruce@qnx.nacjack.gen.nz (Bruce Simpson)
Date: Thu, 28 Jul 94 18:36:58 +1200
Raw View
robert@idt.unit.no (Robert Schmidt) writes:

> I'd appreciate any feed-back on this.  I'd especially like to know if there
> is a distribution ftp site for patches related to Watcom products.  WHELP
> always crashes on me with a page fault.  I got it working by NOPing out
> the offending instruction, but then the font looked a little weird.  So
> I'd really like an official fix.

What platform are you running on?

There are a number of updated help components on the Watcom BBS.  Many
of the problems are related to using QEMM or MAX386 under DOS.  The
details of this are also on the BBS.


+---------------------------------------------------------------+
| Bruce Simpson          | usenet:  bruce@qnx.nacjack.gen.nz    |
| P.O. Box 24-394        |  QUICS:  basimpson                   |
| Royal Oak              |  voice:  +64 9 4202554               |
| Auckland               | mobile:  +64 2 5981133 (+vmail)      |
| New Zealand            |    fax:  +64 9 4202762               |
+---------------------------------------------------------------+




Author: keithb@corp.hp.com (Keith Bagley)
Date: 28 Jul 1994 20:24:14 GMT
Raw View
In article <BgP7Pc3w165w@qnx.nacjack.gen.nz> bruce@qnx.nacjack.gen.nz (Bruce Simpson) writes:
>robert@idt.unit.no (Robert Schmidt) writes:
>
>
>What platform are you running on?
>
>There are a number of updated help components on the Watcom BBS.  Many
>of the problems are related to using QEMM or MAX386 under DOS.  The
>details of this are also on the BBS.
>
>
Is there a link to the Watcom BBS via the internet? If so does anyone
know what it is? Thanks

Keith
---------------------------
MSY tiny-.sig!
---------------------------