Skip to content

Commit 9bbb674

Browse files
authored
Update SemaInit.cpp
1 parent 0146c05 commit 9bbb674

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

clang/lib/Sema/SemaInit.cpp

+7-5
Original file line numberDiff line numberDiff line change
@@ -6512,11 +6512,13 @@ void InitializationSequence::InitializeFrom(Sema &S,
65126512
// - The destination type is not a pointer and is not volatile-qualified.
65136513
// This checks for a specific scenario where a C-style cast might be necessary
65146514
// to convert between these specific types under these conditions.
6515-
if (isa<PointerType>(SourceType) && !isa<PointerType>(DestType) &&
6516-
SourceType.getAsString() != DestType.getAsString() &&
6517-
SourceType.getAsString().find(" volatile ") != std::string::npos &&
6518-
DestType.getAsString().find(" volatile ") == std::string::npos)
6519-
IsCStyleCast = true;
6515+
if (S.getLangOpts().MSVCCompat || S.getLangOpts().MicrosoftExt) {
6516+
if (isa<PointerType>(SourceType) && !isa<PointerType>(DestType) &&
6517+
SourceType.getAsString() != DestType.getAsString() &&
6518+
SourceType.getAsString().find(" volatile ") != std::string::npos &&
6519+
DestType.getAsString().find(" volatile ") == std::string::npos)
6520+
IsCStyleCast = true;
6521+
}
65206522

65216523
// - Otherwise, the initial value of the object being initialized is the
65226524
// (possibly converted) value of the initializer expression. Standard

0 commit comments

Comments
 (0)