llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)

<details>
<summary>Changes</summary>

We always consider undeduced specializations as NeedDefinition, despite 
UsableInConstantExpr.

Fixes https://github.com/llvm/llvm-project/issues/116319

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


2 Files Affected:

- (modified) clang/lib/Sema/SemaExpr.cpp (+1-2) 
- (modified) clang/test/CodeGenCXX/gh56652.cpp (+1) 


``````````diff
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index e29caaab8e3f30..982d478f57ae4d 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -20977,8 +20977,7 @@ static void DoMarkVarDeclReferenced(
 
   bool NeedDefinition =
       OdrUse == OdrUseContext::Used || NeededForConstantEvaluation ||
-      (TSK != clang::TSK_Undeclared && !UsableInConstantExpr &&
-       Var->getType()->isUndeducedType());
+      (TSK != clang::TSK_Undeclared && Var->getType()->isUndeducedType());
 
   assert(!isa<VarTemplatePartialSpecializationDecl>(Var) &&
          "Can't instantiate a partial template specialization.");
diff --git a/clang/test/CodeGenCXX/gh56652.cpp 
b/clang/test/CodeGenCXX/gh56652.cpp
index 06a496e320bfc1..066331030ba25a 100644
--- a/clang/test/CodeGenCXX/gh56652.cpp
+++ b/clang/test/CodeGenCXX/gh56652.cpp
@@ -33,6 +33,7 @@ template <class> static void c() noexcept(noexcept(b<int>)) {}
 
 void test() { a<>::c<int>(); }
 
+static_assert(sizeof(S<>::b<int>) == sizeof(int));
 
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/237843
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to