This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/18165] incorrect evaluation of copy constructor on return statement
- From: "matei at cs dot toronto.edu" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 26 Mar 2015 16:22:09 +0000
- Subject: [Bug gdb/18165] incorrect evaluation of copy constructor on return statement
- Auto-submitted: auto-generated
- References: <bug-18165-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=18165
--- Comment #4 from Matei David <matei at cs dot toronto.edu> ---
So, if I understand correctly:
- For our purposes, copy constructors have 4 relevant properties:
(1) user-defined or not
(2) trivial or not
(3) signature
(4) call convention (is this different from 2?)
- The debug information is enough to infer (1)&(3) but not (2)&(4).
- GDB prior to 7.9 had a different bug, related to (3). With the new example, I
can see 7.8.2 crashing while trying to call a (user-defined, non-trivial,
const-ref) copy ctor.
- GDB 7.9 fixed that, but in the process caught another bug related to (2).
- In general, GDB needs (4) to execute a constructor call.
- The core issue is that the compiler gcc/clang does not provide (2)&(4) as
part of the debug information.
If that's right, who should be informed about this issue? Is it the gcc
developers? Or is the debug information part of some standard and gcc simply
implement that?
In the meantime, what would you suggest as workaround? I'd suspect that having
a non-const-ref copy constructor is usually the hardest change to implement. If
one really needs a const-ref copy ctor:
- if it is user-defined and explicit, 7.8.2 crashes while executing it
- if it is user-defined and defaulted, 7.9 executes it incorrectly
The only option seems to be to have it non-user-defined, i.e., implicit.
Reading this: http://en.cppreference.com/w/cpp/language/copy_constructor
To get an implicit copy ctor, one has to not have a user-defined move ctor or a
move asop. Furthermore, implicit copy ctor are deprecated in the presence of a
user-defined dtor or copy asop.
--
You are receiving this mail because:
You are on the CC list for the bug.