[PATCH] D125402: [clang][diag] warn if function returns class type by-const-value

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 12 06:31:03 PDT 2022


erichkeane added inline comments.


================
Comment at: clang/lib/Sema/SemaType.cpp:5203
+          T.isConstQualified() &&
+          T->isStructureOrClassType()) {
+        const SourceLocation ConstLoc = D.getDeclSpec().getConstSpecLoc();
----------------
I wonder if this is same concern applies to Unions?  Should this just be `T->isRecordType()`?  Should we do more analysis to ensure that this is a movable type? I THINK `CXXRecordDecl::defaultedMoveConstructorIsDeleted()` should be enough to test for t his.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125402/new/

https://reviews.llvm.org/D125402



More information about the cfe-commits mailing list