https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81176
Bug ID: 81176
Summary: decltype(auto) yields reference type for structured
binding
Product: gcc
Version: 7.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: barry.revzin at gmail dot com
Target Milestone: ---
>From StackOverflow (https://stackoverflow.com/q/44698195/2069064), this static
assert trips:
#include <type_traits>
#include <tuple>
int main() {
auto tup = std::make_tuple(1, 2);
auto [ a, b ] = tup;
decltype(auto) c = a;
static_assert(!std::is_reference<decltype(c)>::value, "!");
}
But c should not be a reference type because decltype(a) is int.