# HG changeset patch # User Christian Brabandt # Date 1447161304 -3600 # Node ID c6a7305972febcc631601d820c447bf5604bcabe # Parent c2720942f4a9e0323783d75173e37dae36fda4a8 commit https://github.com/vim/vim/commit/e01f4f86cef7bed3cb99b26f9f57d86f6eb5fe1a Author: Bram Moolenaar Date: Tue Nov 10 14:06:53 2015 +0100 patch 7.4.912 Problem: Wrong indenting for C++ constructor. Solution: Recognize ::. (Anhong) diff --git a/src/misc1.c b/src/misc1.c --- a/src/misc1.c +++ b/src/misc1.c @@ -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; } diff --git a/src/testdir/test3.in b/src/testdir/test3.in --- a/src/testdir/test3.in +++ b/src/testdir/test3.in @@ -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 diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok --- a/src/testdir/test3.ok +++ b/src/testdir/test3.ok @@ -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 diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -742,6 +742,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 912, +/**/ 911, /**/ 910,