зеркало из https://github.com/microsoft/clang-1.git
Don't produce diagnostics for missing ctor-initializers during template
instantiations if we encountered errors parsing some of the initializers. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164578 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
6319917b50
Коммит
54b3ba8cf2
|
@ -2965,7 +2965,11 @@ bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor,
|
|||
NumInitializers * sizeof(CXXCtorInitializer*));
|
||||
Constructor->setCtorInitializers(baseOrMemberInitializers);
|
||||
}
|
||||
|
||||
|
||||
// Let template instantiation know whether we had errors.
|
||||
if (AnyErrors)
|
||||
Constructor->setInvalidDecl();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -2986,7 +2986,7 @@ Sema::InstantiateMemInitializers(CXXConstructorDecl *New,
|
|||
const MultiLevelTemplateArgumentList &TemplateArgs) {
|
||||
|
||||
SmallVector<CXXCtorInitializer*, 4> NewInits;
|
||||
bool AnyErrors = false;
|
||||
bool AnyErrors = Tmpl->isInvalidDecl();
|
||||
|
||||
// Instantiate all the initializers.
|
||||
for (CXXConstructorDecl::init_const_iterator Inits = Tmpl->init_begin(),
|
||||
|
|
|
@ -53,3 +53,20 @@ namespace PR7259 {
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
namespace NonDependentError {
|
||||
struct Base { Base(int); }; // expected-note 2{{candidate}}
|
||||
|
||||
template<typename T>
|
||||
struct Derived1 : Base {
|
||||
Derived1() : Base(1, 2) {} // expected-error {{no matching constructor}}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct Derived2 : Base {
|
||||
Derived2() : BaseClass(1) {} // expected-error {{does not name a non-static data member or base}}
|
||||
};
|
||||
|
||||
Derived1<void> d1;
|
||||
Derived2<void> d2;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче