diff --git a/clang/lib/Sema/SemaInit.cpp b/clang/lib/Sema/SemaInit.cpp index 5909457b04e66..0dd5f468cf60b 100644 --- a/clang/lib/Sema/SemaInit.cpp +++ b/clang/lib/Sema/SemaInit.cpp @@ -2030,13 +2030,8 @@ canInitializeArrayWithEmbedDataString(ArrayRef ExprList, if (InitType->isArrayType()) { const ArrayType *InitArrayType = InitType->getAsArrayTypeUnsafe(); - QualType InitElementTy = InitArrayType->getElementType(); - QualType EmbedExprElementTy = EE->getDataStringLiteral()->getType(); - const bool TypesMatch = - Context.typesAreCompatible(InitElementTy, EmbedExprElementTy) || - (InitElementTy->isCharType() && EmbedExprElementTy->isCharType()); - if (TypesMatch) - return true; + StringLiteral *SL = EE->getDataStringLiteral(); + return IsStringInit(SL, InitArrayType, Context) == SIF_None; } return false; } diff --git a/clang/test/Analysis/embed.c b/clang/test/Analysis/embed.c index 32f6c13032574..db8c270fb35de 100644 --- a/clang/test/Analysis/embed.c +++ b/clang/test/Analysis/embed.c @@ -8,5 +8,5 @@ int main() { #embed "embed.c" }; clang_analyzer_dump_ptr(SelfBytes); // expected-warning {{&Element{SelfBytes,0 S64b,unsigned char}}} - clang_analyzer_dump(SelfBytes[0]); // expected-warning {{Unknown}} FIXME: This should be the `/` character. + clang_analyzer_dump(SelfBytes[0]); // expected-warning {{47 U8b}} }