Don't finalize checking of base and member initializers for a
constructor template. Fixes PR10457.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140350 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index 6f14e61..616f798 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2373,7 +2373,7 @@
                                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) {
diff --git a/test/SemaTemplate/delegating-constructors.cpp b/test/SemaTemplate/delegating-constructors.cpp
new file mode 100644
index 0000000..5c7d85f
--- /dev/null
+++ b/test/SemaTemplate/delegating-constructors.cpp
@@ -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");
+  }
+}