patch 7.4.912
Problem: Wrong indenting for C++ constructor.
Solution: Recognize ::. (Anhong)
diff --git a/src/misc1.c b/src/misc1.c
index fa1e049..5190db4 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -6250,6 +6250,19 @@
{
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
index f3d4f18..c0a68d0 100644
--- a/src/testdir/test3.in
+++ b/src/testdir/test3.in
Binary files differ
diff --git a/src/testdir/test3.ok b/src/testdir/test3.ok
index 477aacc..c4c01a3 100644
--- a/src/testdir/test3.ok
+++ b/src/testdir/test3.ok
@@ -651,6 +651,13 @@
{
}
+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
index 734f84f..a0896f8 100644
--- a/src/version.c
+++ b/src/version.c
@@ -742,6 +742,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 912,
+/**/
911,
/**/
910,