Index: Sema/CMakeLists.txt =================================================================== --- Sema/CMakeLists.txt +++ Sema/CMakeLists.txt @@ -5,6 +5,7 @@ add_clang_unittest(SemaTests ExternalSemaSourceTest.cpp CodeCompleteTest.cpp + OverloadTest.cpp ) target_link_libraries(SemaTests Index: Sema/OverloadTest.cpp =================================================================== --- /dev/null +++ Sema/OverloadTest.cpp @@ -0,0 +1,21 @@ +//=== unittests/Sema/CodeCompleteTest.cpp - Code Complete tests ==============// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "clang/Sema/Overload.h" +#include "gtest/gtest.h" + +namespace { + +TEST(SemaOverloadTest, FoundDeclIsInitializedInOverloadCandidate) { + clang::OverloadCandidate foo; + EXPECT_EQ(foo.FoundDecl.getDecl(), nullptr); + EXPECT_EQ(foo.FoundDecl.getAccess(), clang::AS_none); +} + +} // namespace Index: clang/Sema/Overload.h =================================================================== --- clang/Sema/Overload.h +++ clang/Sema/Overload.h @@ -728,6 +728,11 @@ /// OverloadCandidate - A single candidate in an overload set (C++ 13.3). struct OverloadCandidate { + + OverloadCandidate() + : FoundDecl( DeclAccessPair::make(nullptr, AS_none)) + { } + /// Function - The actual function that this candidate /// represents. When NULL, this is a built-in candidate /// (C++ [over.oper]) or a surrogate for a conversion to a