🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #1439

Re: CWP6: illegal implicit conversion...

#1439
From: Howard Hinnant
Date: Fri, 22 Sep 2000 00:00
41 lines
2050 bytes
In article <macdev-42A394.02363922092000@news.mit.edu>, meeroh
<macdev@meeroh.org> wrote:

| Then writing:
| 
| Fun (Foo (2));
| 
| is exactly the same as writing
| 
| const Foo   __temporary (2);
| Fun (__temporary);

Just a minor correction to meeroh's excellent explanation.  The temporary
is not const.

class zurk
{
public:
 zurk(int z) {zonk=z;}
 void const_method() const {}
 int zonk;
};
...
 zurk(2).const_method(); // ok

But nevertheless, meeroh's argument holds.  Ref:

13.3.3.1.4 - Reference binding
...
-3- A standard conversion sequence cannot be formed if it requires binding
a reference to non-const to an rvalue (except when binding an implicit
object parameter; see the special rules for that case in
over.match.funcs). [Note: this means, for example, that a candidate
function cannot be a viable function if it  has a non-const reference
parameter (other than the implicit object parameter)  and the
corresponding argument is a temporary or would require one to be created
to initialize the reference (see dcl.init.ref). ] 

And yes, the comiler has gotten stricter in this regard between 5.3 and 6.

-Howard
Technical Details
Message-ID: <hinnant-2209000906530001@ith3-427.twcny.rr.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39CA60B0.DC1700A2@mindspring.com> <39CA6ACD.31F060CF@mindspring.com> <macdev-649CBD.23265021092000@news.mit.edu> <39CAF8B8.8A567B6C@optonline.net> <macdev-42A394.02363922092000@news.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,4a0d644260b480cb
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,4a0d644260b480cb
X-Google-Attributes: gidf635e,public
From: hinnant@anti-spam_metrowerks.com (Howard Hinnant)
Subject: Re: CWP6: illegal implicit conversion...
Date: 2000/09/22
Message-ID: <hinnant-2209000906530001@ith3-427.twcny.rr.com>
X-Deja-AN: 672844896
References: <39CA60B0.DC1700A2@mindspring.com> <39CA6ACD.31F060CF@mindspring.com> <macdev-649CBD.23265021092000@news.mit.edu> <39CAF8B8.8A567B6C@optonline.net> <macdev-42A394.02363922092000@news.mit.edu>
X-Complaints-To: abuse@twcny.rr.com
X-Trace: typhoon.nyroc.rr.com 969627806 24.24.28.39 (Fri, 22 Sep 2000 09:03:26 EDT)
Organization: Metrowerks
NNTP-Posting-Date: Fri, 22 Sep 2000 09:03:26 EDT
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac