]> granicus.if.org Git - vim/commitdiff
patch 7.4.912 v7.4.912
authorBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2015 13:06:53 +0000 (14:06 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 10 Nov 2015 13:06:53 +0000 (14:06 +0100)
Problem:    Wrong indenting for C++ constructor.
Solution:   Recognize ::.  (Anhong)

src/misc1.c
src/testdir/test3.in
src/testdir/test3.ok
src/version.c

index fa1e049d31069745cb28d6e90f64c02bcb9c5aaa..5190db4a1378c7a14e1efe5f501cbe055a2f8503 100644 (file)
@@ -6250,6 +6250,19 @@ cin_isfuncdecl(sp, first_lnum, min_lnum)
     {
        if (cin_iscomment(s))   /* ignore comments */
            s = cin_skipcomment(s);
+       else if (*s == ':')
+       {
+           if (*(s + 1) == ':')
+               s += 2;
+           else
+               /* To avoid a mistake in the following situation:
+                * A::A(int a, int b)
+                *     : a(0)  // <--not a function decl
+                *     , b(0)
+                * {...
+                */
+               return FALSE;
+       }
        else
            ++s;
     }
index f3d4f182f8839852e0565f22de0cd06733264943..c0a68d0941197126cbc03694b1a7dbb5dd478813 100644 (file)
@@ -663,6 +663,13 @@ Constructor::Constructor(int a,
 {
 }
 
+A::A(int a, int b)
+: aa(a),
+bb(b),
+cc(c)
+{
+}
+
 class CAbc :
    public BaseClass1,
    protected BaseClass2
index 477aacc1caa752f384f05a52747557d063319fa1..c4c01a3d4f00ef99487fc143b654de84d13d9f9c 100644 (file)
@@ -651,6 +651,13 @@ Constructor::Constructor(int a,
 {
 }
 
+A::A(int a, int b)
+       : aa(a),
+       bb(b),
+       cc(c)
+{
+}
+
 class CAbc :
        public BaseClass1,
        protected BaseClass2
index 734f84f3c6406ce7a9e51338b3de563391107574..a0896f8d902e1e40b232979d46741c2cb711db13 100644 (file)
@@ -741,6 +741,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    912,
 /**/
     911,
 /**/