Index: cfe/trunk/lib/AST/ASTImporter.cpp =================================================================== --- cfe/trunk/lib/AST/ASTImporter.cpp +++ cfe/trunk/lib/AST/ASTImporter.cpp @@ -3272,23 +3272,6 @@ // decl and its redeclarations may be required. } - // Import Ctor initializers. - if (auto *FromConstructor = dyn_cast(D)) { - if (unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) { - SmallVector CtorInitializers(NumInitializers); - // Import first, then allocate memory and copy if there was no error. - if (Error Err = ImportContainerChecked( - FromConstructor->inits(), CtorInitializers)) - return std::move(Err); - auto **Memory = - new (Importer.getToContext()) CXXCtorInitializer *[NumInitializers]; - std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory); - auto *ToCtor = cast(ToFunction); - ToCtor->setCtorInitializers(Memory); - ToCtor->setNumCtorInitializers(NumInitializers); - } - } - ToFunction->setQualifierInfo(ToQualifierLoc); ToFunction->setAccess(D->getAccess()); ToFunction->setLexicalDeclContext(LexicalDC); @@ -3332,6 +3315,23 @@ return ToFTOrErr.takeError(); } + // Import Ctor initializers. + if (auto *FromConstructor = dyn_cast(D)) { + if (unsigned NumInitializers = FromConstructor->getNumCtorInitializers()) { + SmallVector CtorInitializers(NumInitializers); + // Import first, then allocate memory and copy if there was no error. + if (Error Err = ImportContainerChecked( + FromConstructor->inits(), CtorInitializers)) + return std::move(Err); + auto **Memory = + new (Importer.getToContext()) CXXCtorInitializer *[NumInitializers]; + std::copy(CtorInitializers.begin(), CtorInitializers.end(), Memory); + auto *ToCtor = cast(ToFunction); + ToCtor->setCtorInitializers(Memory); + ToCtor->setNumCtorInitializers(NumInitializers); + } + } + if (D->doesThisDeclarationHaveABody()) { Error Err = ImportFunctionDeclBody(D, ToFunction); Index: cfe/trunk/test/Analysis/Inputs/ctu-other.cpp =================================================================== --- cfe/trunk/test/Analysis/Inputs/ctu-other.cpp +++ cfe/trunk/test/Analysis/Inputs/ctu-other.cpp @@ -164,3 +164,14 @@ int DefaultParmContext::f() { return fDefaultParm(); } + +class TestDelegateConstructor { +public: + TestDelegateConstructor() : TestDelegateConstructor(2) {} + TestDelegateConstructor(int) {} +}; + +int testImportOfDelegateConstructor(int i) { + TestDelegateConstructor TDC; + return i; +} Index: cfe/trunk/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.txt =================================================================== --- cfe/trunk/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.txt +++ cfe/trunk/test/Analysis/Inputs/ctu-other.cpp.externalDefMap.txt @@ -27,3 +27,4 @@ c:@extU ctu-other.cpp.ast c:@S@TestAnonUnionUSR@Test ctu-other.cpp.ast c:@F@testImportOfIncompleteDefaultParmDuringImport#I# ctu-other.cpp.ast +c:@F@testImportOfDelegateConstructor#I# ctu-other.cpp.ast \ No newline at end of file Index: cfe/trunk/test/Analysis/ctu-main.cpp =================================================================== --- cfe/trunk/test/Analysis/ctu-main.cpp +++ cfe/trunk/test/Analysis/ctu-main.cpp @@ -127,6 +127,8 @@ extern int testImportOfIncompleteDefaultParmDuringImport(int); +extern int testImportOfDelegateConstructor(int); + int main() { clang_analyzer_eval(f(3) == 2); // expected-warning{{TRUE}} clang_analyzer_eval(f(4) == 3); // expected-warning{{TRUE}} @@ -163,4 +165,6 @@ clang_analyzer_eval(TestAnonUnionUSR::Test == 5); // expected-warning{{TRUE}} clang_analyzer_eval(testImportOfIncompleteDefaultParmDuringImport(9) == 9); // expected-warning{{TRUE}} + + clang_analyzer_eval(testImportOfDelegateConstructor(10) == 10); // expected-warning{{TRUE}} }