[C++ PATCH] Fix structured binding initializer checking (PR c++/81888)

Jason Merrill jason@redhat.com
Mon Nov 27 21:54:00 GMT 2017


On Thu, Nov 23, 2017 at 3:35 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> My PR81258 fix actually rejects even valid cases.
> The standard says that:
> "The initializer shall be of the form “= assignment-expression”, of the form
> “{ assignment-expression }”, or of the form “( assignment-expression )”
> Now, if the form is = assigment-expression, we can e.g. in templates end up
> with CONSTRUCTOR initializer which has more or fewer elements than 1.
>
> So, this patch restricts the checks to only BRACE_ENCLOSED_INITIALIZER_P
> and only if is_direct_init (i.e. not the = assignment-expression form).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk
> (and 7.x after a while)?

Yes.

Jason



More information about the Gcc-patches mailing list