Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Tue, 11 Feb 2003 15:16:59 -0500 From: Indiana Epilepsy and Child Neurology Subject: Conversion operator and new To: cygwin AT cygwin DOT com Reply-to: BrainChild AT Skyler DOT com Message-id: MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Greetings! g++ produces an error "size in array new must have integral type" in function f2. I expected the conversion operators to convert x to size_t, which is an integral type. They do if I remove *either* the const *or* the non-const version of operator size_t, and they do for passing x to function f1 in any case. Is this a bug? #include struct X { operator size_t () { return 2; } operator size_t () const { return 3; } }; char *f1 ( size_t n ) { return new char[n]; } char *f2 ( const X &x ) { return new char[x]; } int main (void) { } /* $ g t.cpp -ot t.cpp: In function `char* f2(const X&)': t.cpp:11: size in array new must have integral type */ -- Don Stauffer, Office Manager Indiana Epilepsy and Child Neurology, Inc. -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/