<div dir="ltr">Thanks for the simplified test case. I've pushed it at 02e73d4</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 16, 2021 at 10:31 PM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Perhaps the test case could be stripped down a bit?<br><br><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:Consolas,"Liberation Mono",Courier,monospace,Menlo,Monaco,"Courier New",monospace;font-size:14px;line-height:21px;white-space:pre-wrap"><div><span style="color:rgb(86,156,214)">template</span> <span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">typename</span> T<span style="color:rgb(220,220,220)">></span></div><div><span style="color:rgb(86,156,214)">class</span> Array <span style="color:rgb(220,220,220)">{};</span></div><br><div><span style="color:rgb(86,156,214)">template</span> <span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">class</span> T<span style="color:rgb(220,220,220)">></span></div><div><span style="color:rgb(86,156,214)">class</span> S <span style="color:rgb(220,220,220)">{};</span></div><br><div><span style="color:rgb(86,156,214)">template</span> <span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">class</span> T<span style="color:rgb(220,220,220)">></span></div><div>Array<span style="color:rgb(220,220,220)"><</span>T<span style="color:rgb(220,220,220)">></span> Make<span style="color:rgb(220,220,220)">();</span></div><br><div><span style="color:rgb(86,156,214)">void</span> Call<span style="color:rgb(220,220,220)">()</span> <span style="color:rgb(220,220,220)">{</span></div><div> Array<span style="color:rgb(220,220,220)"><</span>S<span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">int</span><span style="color:rgb(220,220,220)">>></span> v <span style="color:rgb(220,220,220)">=</span> Make<span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">const</span> S<span style="color:rgb(220,220,220)"><</span><span style="color:rgb(86,156,214)">int</span><span style="color:rgb(220,220,220)">>>();</span> </div><div><span style="color:rgb(220,220,220)">}</span></div></div></div><br>Seems to exhibit the same issue, by the looks of it.<br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Aug 16, 2021 at 6:38 PM via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Weverything<br>
Date: 2021-08-16T18:34:18-07:00<br>
New Revision: c411c1bd7f7d3550d24333f80980c0be6481d34a<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/c411c1bd7f7d3550d24333f80980c0be6481d34a.diff</a><br>
<br>
LOG: Fix missing qualifier in template type diffing<br>
<br>
Handle SubstTemplateTypeParmType so qualifiers do not get dropped from<br>
the diagnostic message.<br>
<br>
Added: <br>
<br>
<br>
Modified: <br>
clang/lib/AST/ASTDiagnostic.cpp<br>
clang/test/Misc/diag-template-diffing.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/clang/lib/AST/ASTDiagnostic.cpp b/clang/lib/AST/ASTDiagnostic.cpp<br>
index dc22481d0a84c..7e435e8b35b80 100644<br>
--- a/clang/lib/AST/ASTDiagnostic.cpp<br>
+++ b/clang/lib/AST/ASTDiagnostic.cpp<br>
@@ -1088,6 +1088,9 @@ class TemplateDiff {<br>
Ty->getAs<TemplateSpecializationType>())<br>
return TST;<br>
<br>
+ if (const auto* SubstType = Ty->getAs<SubstTemplateTypeParmType>())<br>
+ Ty = SubstType->getReplacementType();<br>
+<br>
const RecordType *RT = Ty->getAs<RecordType>();<br>
<br>
if (!RT)<br>
<br>
diff --git a/clang/test/Misc/diag-template-<br>
diff ing.cpp b/clang/test/Misc/diag-template-<br>
diff ing.cpp<br>
index cc1cc9ca70679..6bf6e2de4277c 100644<br>
--- a/clang/test/Misc/diag-template-<br>
diff ing.cpp<br>
+++ b/clang/test/Misc/diag-template-<br>
diff ing.cpp<br>
@@ -1488,6 +1488,43 @@ void run(A_reg<float> reg, A_ptr<float> ptr, A_ref<float> ref) {<br>
}<br>
}<br>
<br>
+namespace SubstTemplateTypeParmType {<br>
+template <typename T><br>
+class Array {<br>
+};<br>
+<br>
+template <class T><br>
+class S{};<br>
+<br>
+template <class T, int num><br>
+Array<T> Make(T (¶meter)[num]);<br>
+<br>
+void Run(int, Array<S<int>>) {}<br>
+<br>
+Array<const S<int>> Make();<br>
+void Call() {<br>
+ const S<int> s1[5];<br>
+ S<int> s2[5];<br>
+<br>
+ Run(0, Make(s1)); // Error<br>
+ Run(0, Make(s2)); // Okay<br>
+}<br>
+<br>
+// CHECK-ELIDE-NOTREE: no matching function for call to 'Run'<br>
+// CHECK-ELIDE-NOTREE: no known conversion from 'Array<const S<...>>' to 'Array<S<...>>' for 2nd argument<br>
+// CHECK-NOELIDE-NOTREE: no matching function for call to 'Run'<br>
+// CHECK-NOELIDE-NOTREE: no known conversion from 'Array<const S<int>>' to 'Array<S<int>>' for 2nd argument<br>
+// CHECK-ELIDE-TREE: no matching function for call to 'Run'<br>
+// CHECK-ELIDE-TREE: no known conversion from argument type to parameter type for 2nd argument<br>
+// CHECK-ELIDE-TREE: Array<<br>
+// CHECK-ELIDE-TREE: [const != (no qualifiers)] S<...>><br>
+// CHECK-NOELIDE-TREE: no matching function for call to 'Run'<br>
+// CHECK-NOELIDE-TREE: no known conversion from argument type to parameter type for 2nd argument<br>
+// CHECK-NOELIDE-TREE: Array<<br>
+// CHECK-NOELIDE-TREE: [const != (no qualifiers)] S<<br>
+// CHECK-NOELIDE-TREE: int>><br>
+}<br>
+<br>
// CHECK-ELIDE-NOTREE: {{[0-9]*}} errors generated.<br>
// CHECK-NOELIDE-NOTREE: {{[0-9]*}} errors generated.<br>
// CHECK-ELIDE-TREE: {{[0-9]*}} errors generated.<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>
</blockquote></div>