This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ Patch] PR 85227 ("[7/8/ Regression] ICE with structured binding of a forward declared variable")
- From: Jason Merrill <jason at redhat dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>
- Date: Fri, 6 Apr 2018 13:04:59 -0400
- Subject: Re: [C++ Patch] PR 85227 ("[7/8/ Regression] ICE with structured binding of a forward declared variable")
- References: <015b4c9b-5405-7391-42d2-941106b41931@oracle.com>
On Fri, Apr 6, 2018 at 5:01 AM, Paolo Carlini <paolo.carlini@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.
Jason