This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PR c++/71251] out-of-range parms in tmpl arg substitution
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 Mar 2018 17:15:11 -0300
- Subject: Re: [PR c++/71251] out-of-range parms in tmpl arg substitution
- References: <orwoya293a.fsf@lxoliva.fsfla.org> <CADzB+2=SkQ6AvhPC=aTuokDNddE9rm6j0b+QDTpchxb=LH9Txw@mail.gmail.com>
On Mar 20, 2018, Jason Merrill <jason@redhat.com> wrote:
> On Sat, Mar 17, 2018 at 8:13 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> As we go through each of the template parameters, substituting it with
>> corresponding template arguments, an incorrect argument list might
>> cause us to index argument vectors past their length (or fail in the
>> preceding tree checks). Avoid such dereferences and instead issue an
>> error (if requested) if we find the argument index to be past the
>> parameter vector length.
> Any time we hit this abort, it indicates a bug in earlier processing,
> so that we're looking up a template parameter in an argument list for
> a different template.
That doesn't seem to be the case here. The argument list given for U is
<T>, as in the testcase, the problem is that U is misdeclared as taking
<int,int> <typename> (two template levels for a single template).
Should we aim at rejecting the declaration of U?
template<int,int> template<typename> using U=void;
template<typename,typename> struct S1;
template<typename T> struct S1<T,U<T>>{ template<typename> struct S2:S2<T>{}; };
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer