This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19531] New: RVO is performed on volatile temporary
- From: "christian dot bruel at st dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Jan 2005 15:31:04 -0000
- Subject: [Bug c++/19531] New: RVO is performed on volatile temporary
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
RVO is performed on a temporary object that is declared volatile.
That seems contradictory with the ISO standards 12.8 15 (object and copy must
have the same cv-unqualified type).
With the following piece of code, I was excepting the copy constructor and
destructor to be called.
struct String
{
int field;
String();
String(int);
~String();
String (const String &);
String (volatile const String &);
};
String name()
{
volatile String t(777);
return t;
}
checking !TREE_VOLATILE (r) in finish_function where the named return value
optimization is set up fixes the problem.
--
Summary: RVO is performed on volatile temporary
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: christian dot bruel at st dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19531