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:
Richard Smith 2012-09-25 00:23:05 +00:00
Родитель 6319917b50
Коммит 54b3ba8cf2
3 изменённых файлов: 23 добавлений и 2 удалений

Просмотреть файл

@ -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;
}