neath@solar-1.stars.flab.Fujitsu.JUNET (10/17/89)
We have recently upgraded from version 1.2 to 2.0 of the AT&T translator and
are now having problems getting some of our code to compile. In particular,
references to literal character strings seem to be handled differently under
some circumstances. Consider the following external declaration and function:
extern bar (const char *const &s);
char* s = "abc";
void foo () {
bar (s);
bar ("abc");
}
No problem here -- everything works as expected under both versions of cfront.
Now take the following simple class definition and small function:
class dummy {
public:
dummy (const char *const &);
};
void baz () {
dummy a(s);
dummy b("abc");
}
Again, no problem trying to compile under both 1.2 and 2.0 versions of cfront.
However, if I now explicitly add a constructor to dummy that has no arguments
and try to compile, I get the following:
class dummy2 {
public:
dummy2 ();
dummy2 (const char *const &);
};
void baz2 () {
dummy2 a(s);
dummy2 b("abc");
}
% CC2 -c dummy2.C
"dummy2.C", line 8: error: bad argument list for baz2::baz2()
(no match against any baz2::baz2())
1 error
This same code works find under version 1.2 of cfront. I do not understand why
this causes an error? Is there something wrong with what I am trying to do that
generates an error because of the tightening of dismabiguity rules in 2.0? Any
help and/or insight into this problem will be greatly appreciated!
Regards
Martin Neath <neath@dsg.ti.com>
------------------------------------------------------------------------
DISCLAIMER: As always, the opinions expressed above are strictly my own
and do not reflect those of my employer, Texas Instruments.
------------------------------------------------------------------------jeffa@hpmwtd.HP.COM (Jeff Aguilera) (10/24/89)
> class dummy2 { > public: > dummy2 (); > dummy2 (const char *const &); > }; > > void baz2 () { > dummy2 a(s); > dummy2 b("abc"); > } > > % CC2 -c dummy2.C > "dummy2.C", line 8: error: bad argument list for baz2::baz2() > (no match against any baz2::baz2()) > 1 error Using cfront /* <<C++ Translator 2.0 Beta 6 04/12/89>> */, the eleven line program fragment above generates two errors: $ CC -c dummy2.c CC dummy2.c: "dummy2.c", line 8: error: s undefined "dummy2.c", line 8: error: bad argument list for dummy2::dummy2() (no match against any dummy2::dummy2()) CC: 2 errors Something is seriously wrong with the baz2::baz2() error message, since baz2 is a function, not a class.