llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Qizhi Hu (jcsxky)

<details>
<summary>Changes</summary>

Fix [issue](https://github.com/llvm/llvm-project/issues/77189)
AutoType is possible cv qualified.

---
Full diff: https://github.com/llvm/llvm-project/pull/79733.diff


2 Files Affected:

- (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+1) 
- (added) clang/test/SemaTemplate/PR77189.cpp (+22) 


``````````diff
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp 
b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 25e58f7bdd953d1..f08577febcd3e80 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -649,6 +649,7 @@ static bool IsPossiblyOpaquelyQualifiedTypeInternal(const 
Type *T) {
   case Type::PackIndexing:
   case Type::UnresolvedUsing:
   case Type::TemplateTypeParm:
+  case Type::Auto:
     return true;
 
   case Type::ConstantArray:
diff --git a/clang/test/SemaTemplate/PR77189.cpp 
b/clang/test/SemaTemplate/PR77189.cpp
new file mode 100644
index 000000000000000..dd2e4511a02cf70
--- /dev/null
+++ b/clang/test/SemaTemplate/PR77189.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++20 -verify %s
+// expected-no-diagnostics
+
+struct false_type {
+       static constexpr bool value = false;
+};
+
+struct true_type {
+       static constexpr bool value = true;
+};
+
+template <auto& Value, int>
+struct test : false_type {};
+
+template <auto& Value>
+struct test<Value, 0> : true_type {};
+
+int main() {
+    static constexpr int v = 42;
+    static_assert(test<v, 0>::value);
+}
\ No newline at end of file

``````````

</details>


https://github.com/llvm/llvm-project/pull/79733
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to