This could be added to the regression tests... 2015-08-04 18:09 GMT+03:00 Benjamin Kramer <[email protected]>:
> > > On 04.08.2015, at 17:01, Yaron Keren <[email protected]> wrote: > > > > Did you mean TempParamLists never had more than four members? > > Anyhow, set_size should have asserted if its input is more than the > capacity. > > Yes, and was possible to trigger the assertion with something crazy like > this: > > template <class T> > struct X { > template <class U> > struct A { > template <class V> > struct B { > template <class W> > struct C { > template <class X> > struct D { > template <class Y> > struct E { > template <class Z> > void operator+=(Z); > }; > }; > }; > }; > }; > > template <class U> > template <class V> > template <class W> > template <class X> > template <class Y> > template <class Z> > friend void A<U>::template B<V>::template C<W>::template > D<X>::template E<Y>::operator+=(Z); > }; > > void test() { > X<int>::A<int>::B<int>::C<int>::D<int>::E<int>() += 1.0; > }; > > I don't think that's valid C++ though. We have zero test coverage for > TempParamLists.size() > 1. > > - Ben > > > 2015-08-04 17:46 GMT+03:00 Benjamin Kramer <[email protected]>: > > Author: d0k > > Date: Tue Aug 4 09:46:06 2015 > > New Revision: 243987 > > > > URL: http://llvm.org/viewvc/llvm-project?rev=243987&view=rev > > Log: > > [Sema] Allocate SmallVector to the right size. > > > > SmallVector::set_size does not reallocate the vector. Sadly I have no > > idea how to test this. The vector never has more than one member in all > > of the regression tests. > > > > Found by inspection. > > > > Modified: > > cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp > > > > Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp > > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=243987&r1=243986&r2=243987&view=diff > > > ============================================================================== > > --- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original) > > +++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Tue Aug 4 > 09:46:06 2015 > > @@ -1657,7 +1657,7 @@ TemplateDeclInstantiator::VisitCXXMethod > > SmallVector<TemplateParameterList *, 4> TempParamLists; > > unsigned NumTempParamLists = 0; > > if (isFriend && (NumTempParamLists = > D->getNumTemplateParameterLists())) { > > - TempParamLists.set_size(NumTempParamLists); > > + TempParamLists.resize(NumTempParamLists); > > for (unsigned I = 0; I != NumTempParamLists; ++I) { > > TemplateParameterList *TempParams = > D->getTemplateParameterList(I); > > TemplateParameterList *InstParams = > SubstTemplateParams(TempParams); > > > > > > _______________________________________________ > > cfe-commits mailing list > > [email protected] > > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > > > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
