[PATCH] PR15677 - Crash in template diffing.

Nikola Smiljanić popizdeh at gmail.com
Mon Jun 30 19:47:59 PDT 2014


================
Comment at: lib/AST/ASTDiagnostic.cpp:1131-1137
@@ +1130,9 @@
+    if (Iter.isEnd() && ArgExpr->isValueDependent()) {
+      TemplateArgument::ArgKind Kind = Iter.getDesugar().getKind();
+      if (Kind == TemplateArgument::Integral) {
+        Int = Iter.getDesugar().getAsIntegral();
+      } else if (Kind == TemplateArgument::Expression) {
+        ArgExpr = Iter.getDesugar().getAsExpr();
+        Int = ArgExpr->EvaluateKnownConstInt(Context);
+      } else {
+        llvm_unreachable("Unexpected template argument kind");
----------------
Richard Trieu wrote:
> Why did you change from a switch statement to an if chain here?
The entire function was coded in Phabricator and was missing breaks. After adding those it seem to be a fair bit longer than needed. Do you want me to change it?

http://reviews.llvm.org/D4226






More information about the cfe-commits mailing list