I'm past this snag, so disregard this RFC for now. If I post again about this, it will be with a working patch.
On Fri, Sep 17, 2021 at 11:15 AM Barrett Adair <barrettellisad...@gmail.com> wrote: > The WIP attached patch attempts to enable usage of parameters' constexpr > members before the function body begins (see new tests dependent-expr11.C > and dependent-expr12.C). > > Unfortunately, I hit a "vexing" snag: gcc/testsuite/g++.dg/parse/ambig7.C > breaks with this patch. After several hours of debugging, here's what I > think happens: > > In trunk, ambig7.C's testFail line compiles because the tentative parse -- > where "testFail" is a function and int(A) is a parameter type -- fails only > when seeing that function<A> uses "parameter outside function body" (the > error removed by this patch). This occurs when parsing the template > argument list, before calling finish_template_type. > > After applying the patch, the tentative parse still fails because > function<A> is not a type, but this only occurs after finish_template_type > is called, which causes the incorrect template-id for function<A> to be > cached with broken arguments, such that function<A> remains "unresolved > overloaded function type": > > ambig7.C:16:36: error: no matching function for call to > ‘Helper::Helper(int, <unresolved overloaded function type>)’ > 16 | Helper testFail(int(A), function<A>); > > Any suggestions on how to go about fixing this? For instance, is it > possible to repair or roll back the cached template instantation? > >