[clang] [Sema] Diagnose by-value copy constructors in template instantiations (PR #130866)

via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 21:55:08 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 c2ed840ed94d3412c7c0bdd9ed84cac6fe0afb57 790d151975c9ce4f5f823484d100d9460077b971 --extensions cpp -- clang/test/SemaCXX/copy-ctor-template.cpp clang/lib/Sema/SemaDeclCXX.cpp clang/test/SemaTemplate/constructor-template.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 1c62a551ee..00b4006b5e 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -10921,8 +10921,7 @@ void Sema::CheckConstructor(CXXConstructorDecl *Constructor) {
   //   parameters have default arguments.
   if (!Constructor->isInvalidDecl() &&
       Constructor->hasOneParamOrDefaultArgs() &&
-      !Constructor->isFunctionTemplateSpecialization()
-          ) {
+      !Constructor->isFunctionTemplateSpecialization()) {
     QualType ParamType = Constructor->getParamDecl(0)->getType();
     QualType ClassTy = Context.getTagDeclType(ClassDecl);
     if (Context.getCanonicalType(ParamType).getUnqualifiedType() == ClassTy) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/130866


More information about the cfe-commits mailing list