EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp)
From: Michael Davidsaver <[email protected]>
To: Dirk Zimoch <[email protected]>, [email protected]
Date: Thu, 23 Nov 2017 09:00:22 -0600
On 11/23/2017 06:56 AM, Dirk Zimoch wrote:
> https://gcc.gnu.org/bugs/#cxx_rvalbind

Well, that explains it.  Thanks Dirk.

> On 23.11.2017 12:03, Dirk Zimoch wrote:
>>
>>
>> On 23.11.2017 11:19, Dirk Zimoch wrote:
>>> Clang 3.4.2 gives an interesting hint with its warnings. It seems that
>>> this call creates a temporary, for which of course a copy is needed. If
>>> you wanted to detect accidental copies, this is such a case.
>>
>> I have analyzed the code a bit.
>>
>> The message was:
>> "C++98 requires an accessible copy constructor for class 'FieldName'
>> when binding a reference to a temporary"
>>
>> The line in question is:
>> pvif(channel->pv->builder->attach(channel->pv->chan, pvf, FieldName()))
>>
>> This is the constructor call of pvif in the constructor of PDBSinglePut.
>> It is true, that a temporary is used here. FieldName() creates an object
>> that falls out of scope immediately after the attach() call.
>>
>> The compiler cannot know what builder->attach() will do with with the
>> temporary. It has to expect the worst, which is to keep a reference to
>> the temporary FieldName object after the attach() call has returned.
>> Since this would then reference an invalid object.
>>
>> So maybe the compiler rather implicitly creates a copy of which
>> builder->attach can keep a reference, like this:   attach(new
>> FieldName(FieldName()))
>>
>> I need to check the C++ standard to see what the documented behavior is
>> in such a case.
>>


References:
EPICS 7.0.1-pre1 Andrew Johnson
Re: EPICS 7.0.1-pre1 Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Michael Davidsaver
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch

Navigate by Date:
Prev: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Next: Re: EPICS 7.0.1-pre1 (spinlock.hpp) Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: EPICS 7.0.1-pre1 (pdbsingle.cpp) Dirk Zimoch
Next: Re: EPICS 7.0.1-pre1 (spinlock.hpp) Dirk Zimoch
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
ANJ, 21 Dec 2017 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·