bug #1479: fix failure detection in LDLT
diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h
index 968427b..13a8f6d 100644
--- a/Eigen/src/Cholesky/LDLT.h
+++ b/Eigen/src/Cholesky/LDLT.h
@@ -375,6 +375,8 @@
 
       if((rs>0) && pivot_is_valid)
         A21 /= realAkk;
+      else if(rs>0)
+        ret = ret && (A21.array()==Scalar(0)).all();
 
       if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed
       else if(!pivot_is_valid) found_zero_pivot = true;
diff --git a/test/cholesky.cpp b/test/cholesky.cpp
index 8ad5ac6..b4b6bda 100644
--- a/test/cholesky.cpp
+++ b/test/cholesky.cpp
@@ -373,6 +373,7 @@
     VERIFY(ldlt.info()==Success);
     VERIFY(!ldlt.isNegative());
     VERIFY(!ldlt.isPositive());
+    VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix());
   }
   {
     mat << 1, 2, 2, 1;
@@ -380,6 +381,7 @@
     VERIFY(ldlt.info()==Success);
     VERIFY(!ldlt.isNegative());
     VERIFY(!ldlt.isPositive());
+    VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix());
   }
   {
     mat << 0, 0, 0, 0;
@@ -387,6 +389,7 @@
     VERIFY(ldlt.info()==Success);
     VERIFY(ldlt.isNegative());
     VERIFY(ldlt.isPositive());
+    VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix());
   }
   {
     mat << 0, 0, 0, 1;
@@ -394,6 +397,7 @@
     VERIFY(ldlt.info()==Success);
     VERIFY(!ldlt.isNegative());
     VERIFY(ldlt.isPositive());
+    VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix());
   }
   {
     mat << -1, 0, 0, 0;
@@ -401,6 +405,7 @@
     VERIFY(ldlt.info()==Success);
     VERIFY(ldlt.isNegative());
     VERIFY(!ldlt.isPositive());
+    VERIFY_IS_APPROX(mat,ldlt.reconstructedMatrix());
   }
 }
 
@@ -452,6 +457,18 @@
     VERIFY(ldlt.info()==NumericalIssue);
     VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix());
   }
+
+  // bug 1479
+  {
+    mat.resize(4,4);
+    mat <<  1, 2, 0, 1,
+            2, 4, 0, 2,
+            0, 0, 0, 1,
+            1, 2, 1, 1;
+    ldlt.compute(mat);
+    VERIFY(ldlt.info()==NumericalIssue);
+    VERIFY_IS_NOT_APPROX(mat,ldlt.reconstructedMatrix());
+  }
 }
 
 template<typename MatrixType> void cholesky_verify_assert()