Init LookupResult::AmbiguityKind
authorVitaly Buka <vitalybuka@google.com>
Wed, 26 Sep 2018 22:58:53 +0000 (22:58 +0000)
committerVitaly Buka <vitalybuka@google.com>
Wed, 26 Sep 2018 22:58:53 +0000 (22:58 +0000)
We don't expect useful value there unless it's "ambiguous".
However we use read it for copying and moving, so we need either init the field
add login to avoid reading invalid values. Such reads trigger ubsan errors.

llvm-svn: 343150

clang/include/clang/Sema/Lookup.h

index faf2343..ef28421 100644 (file)
@@ -709,7 +709,9 @@ private:
 
   // Results.
   LookupResultKind ResultKind = NotFound;
-  AmbiguityKind Ambiguity; // ill-defined unless ambiguous
+  // ill-defined unless ambiguous. Still need to be initialized it will be
+  // copied/moved.
+  AmbiguityKind Ambiguity = {}; 
   UnresolvedSet<8> Decls;
   CXXBasePaths *Paths = nullptr;
   CXXRecordDecl *NamingClass = nullptr;