[cfe-commits] [Patch] Fix crasher during failed template deduction of derived class
Douglas Gregor
dgregor at apple.com
Tue Nov 6 22:47:41 PST 2012
LGTM
On Nov 2, 2012, at 1:50 PM, Richard Trieu <rtrieu at google.com> wrote:
> On Tue, Oct 9, 2012 at 5:05 PM, Richard Trieu <rtrieu at google.com> wrote:
> On Tue, Oct 9, 2012 at 5:04 PM, Richard Trieu <rtrieu at google.com> wrote:
> The following code causes a crash:
>
> template<typename T> class vector2 {};
> template<typename T> class vector : vector2<T> {};
>
> template<typename T> void Foo(vector<const T*> V) {}
>
> void test() {
> Foo(vector<int*>());
> }
>
> Once template deduction fails in vector, it tries again with with the base class vector2 and also fails, but with a different status. However, the TemplateDeductionInfo is updated, but the old status is kept. This leads to an assert later when the diagnostic is produced. This patch introduces a temporary TemplateDeductionInfo to capture the information from the base class template deduction, and only overrides the old info if the template deduction is successful.
>
> Oops. And here's the patch.
>
> Ping.
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20121106/2f67b000/attachment.html>
More information about the cfe-commits
mailing list