[PATCH] Fix PR1806: Canonicalize the replacement type when deserializing a SubstTemplateTypeParmType

Richard Smith richard at metafoo.co.uk
Thu Mar 13 15:05:17 PDT 2014


  I assume this is PR18806 (not PR1806)?

  It would seem straightforward to add your testcase from the bug into the test suite, so please do that. Generally, every functional change should have a test where that's reasonably possible.


================
Comment at: lib/Serialization/ASTReader.cpp:5193-5194
@@ -5195,1 +5192,4 @@
+    return Context.getSubstTemplateTypeParmType(
+        cast<TemplateTypeParmType>(Parm),
+        Context.getCanonicalType(Replacement));
   }
----------------
This change looks correct in general (there's no guarantee that a type that was canonical before we serialized the AST will still be canonical when we restore it, especially in the presence of modules, where a `CXXRecordDecl` that was canonical when we saved might not be canonical when we restore), but I don't immediately see why your testcase would trigger this.

Can you describe what's going on here?


http://llvm-reviews.chandlerc.com/D3073



More information about the cfe-commits mailing list