OK.
On Fri, Apr 6, 2018 at 3:05 PM, Paolo Carlini <paolo.carl...@oracle.com> wrote: > Hi, > > On 06/04/2018 19:04, Jason Merrill wrote: >> >> On Fri, Apr 6, 2018 at 5:01 AM, Paolo Carlini <paolo.carl...@oracle.com> >> wrote: >>> >>> here, for an incomplete type we ICE pretty soon in >>> find_decomp_class_base. >>> Comparing to other cases too, I convinced myself that trying to complete >>> the >>> type is Ok. Also, it seems that in these functions we want to talk about >>> structured binding and use an appropriate location, thus no >>> complete_type_or_maybe_complain. Tested x86_64-linux. >> >> What if, in a template, we defer trying to do bindings to an incomplete >> type, so >> >> extern struct A a; >> >> template<int> >> void f() >> { >> auto [x] = a; >> } >> >> struct A { int i; }; >> >> int main() >> { >> f<0>(); >> } >> >> works? Probably with a pedwarn, as in xref_basetypes or >> cp_parser_dot_deref_incomplete. > > Ok... I tested the very simple patch below, wasnt sure between pedwarn (loc, > 0, ...) and pedwarn (loc, OPT_Wpedantic, ...) but probably we want to former > in order not to be too permissive (for comparison, clang rejects with an > hard error both tests). What do you think? > > Thanks! > Paolo. > > /////////////////////