Article View: comp.std.c++
Article #3589Inialization and user-defined conversion
From: Alexander Krotoff
Date: Tue, 05 Mar 1996 17:45
Date: Tue, 05 Mar 1996 17:45
47 lines
1819 bytes
1819 bytes
Hello c++ gurus,
I have a confusion with initialization of class objects.
Example:
class C {
public:
C(int i);
};
class D {
public:
D(C c);
};
D d = 1;
void f()
{
D d = 1;
}
I assume, that both initializations are wrong, since they require sequence
of two user-defined conversions. But some compilers disaggre ;-)
Boralnd c++ 4.0: cannot convert "int" to "D"
g++ 2.7.2: no matching funcion for call to "D::D(int)"
MS VC 4.0: no errors
Watcom 10.0: no errors
As seems to me only Borland gives adequate diagnostics.
Who is right ?
Thank you in advance,
--
Alexander N. Krotoff krotoff@such.srcc.msu.su
Research Computer Center tel: +7(095)939-2638
Moscow State University fax: +7(095)939-4430
---
[ comp.std.c++ is moderated. To submit articles: Try just posting with your
newsreader. If that fails, use mailto:std-c++@ncar.ucar.edu
comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
Comments? mailto:std-c++-request@ncar.ucar.edu
]
Technical Details
Message-ID:
<199603051249.PAA00513@boy.nmd.msu.ru>Path:
arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austernShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern From: Alexander Krotoff <krotoff@boy.nmd.msu.ru> Newsgroups: comp.std.c++ Subject: Inialization and user-defined conversion Date: 05 Mar 1996 09:45:02 PST Organization: - Approved: austern@isolde.mti.sgi.com Message-ID: <199603051249.PAA00513@boy.nmd.msu.ru> Reply-To: krotoff@such.srcc.msu.su NNTP-Posting-Host: isolde.mti.sgi.com Content-Type: text X-Original-Date: Tue, 5 Mar 1996 15:49:34 +0300 (GMT+0300) X-Mailer: ELM [version 2.4 PL24] X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMTx9wUy4NqrwXLNJAQHF/QH/dpU3si7TyYKDLtpmNwoHnsmM6gAKstiT rZAqWGERym/3bbtz7u8wj8nWLNk1j0MsvDJsQb74lQOKpW86eenCFQ== =PJU/ Originator: austern@isolde.mti.sgi.com