[clang] Fix missing initializer for inline static template member with auto caused by delayed template instantiation. (PR #138122)
via cfe-commits
cfe-commits at lists.llvm.org
Thu May 1 04:46:47 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/Sema/SemaTemplateInstantiateDecl.cpp clang/test/CodeGenCXX/cxx1z-inline-variables.cpp clang/test/SemaTemplate/cxx17-inline-variables.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index eb66ec34a..c0a0feda6 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -6034,7 +6034,8 @@ void Sema::BuildVariableInstantiation(
}
// Figure out whether to eagerly instantiate the initializer.
- if ((InstantiatingVarTemplate && !VarTemplateWithAutoType) || InstantiatingVarTemplatePartialSpec) {
+ if ((InstantiatingVarTemplate && !VarTemplateWithAutoType) ||
+ InstantiatingVarTemplatePartialSpec) {
// We're producing a template. Don't instantiate the initializer yet.
} else if (NewVar->getType()->isUndeducedType()) {
// We need the type to complete the declaration of the variable.
``````````
</details>
https://github.com/llvm/llvm-project/pull/138122
More information about the cfe-commits
mailing list