Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11272

Re: Odd error I can't seem to recreate

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c++
Subject Re: Odd error I can't seem to recreate
Date Sat, 05 Nov 2011 12:00:27 +1300
Lines 31
Message-ID <9hj94bF62fU6@mid.individual.net> (permalink)
References <bbe45080-3e8d-4e2f-aefc-7ac0906a6872@s7g2000yqa.googlegroups.com> <e65d1df3-c094-463b-b46d-3d20e1000cbd@o5g2000yqa.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-Trace individual.net ncsVbGe6UD0iLTBQKAcxAArcebSsYZOQbpUNUqyWB6689mivuI
Cancel-Lock sha1:1aQf2I7pdhD2abtI6CTpQTIhtsE=
User-Agent Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4
In-Reply-To <e65d1df3-c094-463b-b46d-3d20e1000cbd@o5g2000yqa.googlegroups.com>
Xref x330-a1.tempe.blueboxinc.net comp.lang.c++:11272

Show key headers only | View raw


On 11/ 5/11 09:15 AM, Noah Roberts wrote:
> On Nov 4, 11:52 am, Noah Roberts<roberts.n...@gmail.com>  wrote:
>
>> Under what conditions in which the first could work might the second
>> not when the parameter is const ref?  I can't think of any.
>
> Here's a further revision of the problem code:
>
<snip>
>
> The result of compilation and run without -DHUH:
>
> $ g++ wtf.cpp
> $ ./a.out
> derived::f()
>
> The result with -DHUH:
> $ g++ -DHUH wtf.cpp
> wtf.cpp: In function âint main()â:
> wtf.cpp:14: error: âderived::derived(const derived&)â is private
> wtf.cpp:47: error: within this context
>
> So it appears that the problem is with the temporary being created,
> and that I don't understand.  As far as I knew, const reference
> allowed you to use the initially created temporary directly.  Where's
> the standard text that explains why it's doing this?

Compiler bug?  It compiles fine with gcc 4.5.1.

-- 
Ian Collins

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 11:52 -0700
  Re: Odd error I can't seem to recreate Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-04 15:49 -0400
    Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 12:58 -0700
      Re: Odd error I can't seem to recreate Richard Damon <news.x.richarddamon@xoxy.net> - 2011-11-04 16:15 -0400
  Re: Odd error I can't seem to recreate "Gennaro Prota" <gennaro.prota@gmail.com> - 2011-11-04 21:03 +0100
    Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:07 -0700
      Re: Odd error I can't seem to recreate Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-04 16:43 -0400
        Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:56 -0700
          Re: Odd error I can't seem to recreate "Gennaro Prota" <name.surname@gmail.com> - 2011-11-04 22:16 +0100
    Re: Odd error I can't seem to recreate "Gennaro Prota" <gennaro.prota@gmail.com> - 2011-11-04 21:16 +0100
  Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:15 -0700
    Re: Odd error I can't seem to recreate Ian Collins <ian-news@hotmail.com> - 2011-11-05 12:00 +1300
  Re: Odd error I can't seem to recreate "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-05 18:48 +0100
    Re: Odd error I can't seem to recreate "Gennaro Prota" <name.surname@gmail.com> - 2011-11-05 22:35 +0100

csiph-web