[cfe-commits] r130775 - in /cfe/trunk: lib/Parse/ParseExprCXX.cpp test/SemaTemplate/rdar9173693.cpp
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue May 3 11:45:38 PDT 2011
Author: akirtzidis
Date: Tue May 3 13:45:38 2011
New Revision: 130775
URL: http://llvm.org/viewvc/llvm-project?rev=130775&view=rev
Log:
Fix a double free when parsing malformed code. Fixes rdar://9173693.
Added:
cfe/trunk/test/SemaTemplate/rdar9173693.cpp
Modified:
cfe/trunk/lib/Parse/ParseExprCXX.cpp
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=130775&r1=130774&r2=130775&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Tue May 3 13:45:38 2011
@@ -280,8 +280,11 @@
: TemplateId->TemplateNameLoc;
SS.SetInvalid(SourceRange(StartLoc, CCLoc));
}
-
- TemplateId->Destroy();
+
+ // If we are caching tokens we will process the TemplateId again,
+ // otherwise destroy it.
+ if (!PP.isBacktrackEnabled())
+ TemplateId->Destroy();
continue;
}
Added: cfe/trunk/test/SemaTemplate/rdar9173693.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/rdar9173693.cpp?rev=130775&view=auto
==============================================================================
--- cfe/trunk/test/SemaTemplate/rdar9173693.cpp (added)
+++ cfe/trunk/test/SemaTemplate/rdar9173693.cpp Tue May 3 13:45:38 2011
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+// <rdar://problem/9173693>
+template< bool C > struct assert { };
+template< bool > struct assert_arg_pred_impl { }; // expected-note 3 {{declared here}}
+template< typename Pred > assert<false> assert_not_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type ); // expected-error 5 {{}}
More information about the cfe-commits
mailing list