[Bug c++/80084] New: [7 regression] wrong code for decomposition declaration with debug iterator
lucdanton at free dot fr
gcc-bugzilla@gcc.gnu.org
Fri Mar 17 14:37:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80084
Bug ID: 80084
Summary: [7 regression] wrong code for decomposition
declaration with debug iterator
Product: gcc
Version: 7.0.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: lucdanton at free dot fr
Target Milestone: ---
I managed to reduce to this testcase:
//----------------------------------------
#include <cassert>
#include <vector>
struct aggr {
std::vector<int>::iterator val;
};
void decomp(aggr arg)
{
auto& [val] = arg;
// fires
assert( &val == &arg.val );
}
int main()
{
// inlined decomp
{
aggr arg {};
auto& [val] = arg;
// fine
assert( &val == &arg.val );
}
decomp(aggr {});
}
//----------------------------------
The assertion in decomp fires when the program is compiled with e.g.:
g++-trunk -std=c++1z main.cpp -D_GLIBCXX_DEBUG
According to my bisecting, this change was introduced by r245638.
More information about the Gcc-bugs
mailing list