]> granicus.if.org Git - clang/commitdiff
Pass the base element type of an array type to the visit method instead
authorAkira Hatanaka <ahatanaka@apple.com>
Fri, 8 Feb 2019 19:46:53 +0000 (19:46 +0000)
committerAkira Hatanaka <ahatanaka@apple.com>
Fri, 8 Feb 2019 19:46:53 +0000 (19:46 +0000)
of the array type itself.

This fixes a bug found by inspection that was introduced in r353459. I
don't have a test case for this since we don't yet have types that would
make the containing C struct non-trivial to copy/move but wouldn't make
it non-trivial to default-initialize or destruct.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@353556 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Type.cpp

index 02943ccef90b01207972755dc4aac6552ae30bcc..477fca328cdf2826ba17f003e3461c54cf70f4fb 100644 (file)
@@ -2258,7 +2258,7 @@ struct IsNonTrivialCopyMoveVisitor
 
   bool visitWithKind(QualType::PrimitiveCopyKind PCK, QualType QT) {
     if (const auto *AT = this->Ctx.getAsArrayType(QT))
-      return this->asDerived().visit(QualType(AT, 0));
+      return this->asDerived().visit(Ctx.getBaseElementType(AT));
     return Super::visitWithKind(PCK, QT);
   }