Don't finalize checking of base and member initializers for a

constructor template. Fixes PR10457.

llvm-svn: 140350
This commit is contained in:
Douglas Gregor 2011-09-22 23:04:35 +00:00
parent e83e1b2d2c
commit 5223529b27
2 changed files with 19 additions and 1 deletions

View File

@ -2373,7 +2373,7 @@ bool Sema::SetCtorInitializers(CXXConstructorDecl *Constructor,
CXXCtorInitializer **Initializers,
unsigned NumInitializers,
bool AnyErrors) {
if (Constructor->getDeclContext()->isDependentContext()) {
if (Constructor->isDependentContext()) {
// Just store the initializers as written, they will be checked during
// instantiation.
if (NumInitializers > 0) {

View File

@ -0,0 +1,18 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++0x %s -verify
namespace PR10457 {
class string
{
string(const char* str, unsigned);
public:
template <unsigned N>
string(const char (&str)[N])
: string(str) {} // expected-error{{constructor for 'string<6>' creates a delegation cycle}}
};
void f() {
string s("hello");
}
}