KDE 3.2.2 Build Problems with GCC 3.4
hausmann at kde.org
Sat May 8 10:45:39 BST 2004
On Saturday 08 May 2004 11:14, André Wöbbeking wrote:
> Hi Dirk,
> On Friday 07 May 2004 21:29, Dirk Mueller wrote:
> > The kdeutils/ksim problem is a valid source error. it disables the
> > copy constructor, but uses pass-by-reference. According to C++
> > standards,
> could you tell me the section in the standard. Every time I'm tring to
> find something in the standard I'm lost.
"[dcl.init.ref]/5, bullet 2, sub-bullet 1 and [class.temporary]/2"
That's 184.108.40.206 and 12.2.2, if you prefer numbering scheme.
In particular the first part is of interest:
"If the initializer expression is an rvalue, with T2 a class type, and 'cv1
T1' is reference compatible with 'cv2 T2', the reference is bound in one of
the following ways (the choice is implementation defined):
- A temporary of type 'cv1 T2' is created, and a constructor is called to copy
the entire rvalue object into the temporary. The reference is bound to the
temporary or to a sub-object within the temporary.
The constructor that would be used to make the copy shall be callable whether
or not the copy is actually done"
> > you're not allowed to do that when the copy constructor is
> > private (even though the copy constructor might not get called at
> > all).
> So the attached file shouldn't compile? Hmm, it does (with GCC 3.3 and
None of the two foo calls involves binding an rvalue to the const Dummy &
parameter of foo. However if you add foo(Dummy()); then it'll break.
More information about the kde-core-devel