[Bug c++/84855] structered bindings require "decomposed" type to be copy'able
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Mar 13 23:27:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84855
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Hannes Hauswedell from comment #0)
> I would assume that invoking
> the structed bindings just calls get() twice on the f,
No, that's not how structured bindings are specified to work. There are not
variables 'a' and 'b' defined. Instead a variable 'e' is created from the
initializer expression, and then the identifiers 'a' and 'b' refer to members
of 'e'. The type of 'e' in your example is 'foobar'.
http://en.cppreference.com/w/cpp/language/structured_binding is a good
explanation.
More information about the Gcc-bugs
mailing list