]> granicus.if.org Git - vim/commitdiff
patch 8.0.0092 v8.0.0092
authorBram Moolenaar <Bram@vim.org>
Thu, 17 Nov 2016 20:30:27 +0000 (21:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 17 Nov 2016 20:30:27 +0000 (21:30 +0100)
Problem:    C indenting does not support nested namespaces that C++ 17 has.
Solution:   Add check that passes double colon inside a name. (Pauli, closes
            #1214)

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

index 6bf7d757769b564940e9ba60a9d8a0e91f322efa..3630d7b3b3d31b4fe2eef68cb181bb60affc3381 100644 (file)
@@ -5762,6 +5762,7 @@ cin_is_cpp_namespace(char_u *s)
 {
     char_u     *p;
     int                has_name = FALSE;
+    int                has_name_start = FALSE;
 
     s = cin_skipcomment(s);
     if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9])))
@@ -5780,10 +5781,18 @@ cin_is_cpp_namespace(char_u *s)
            }
            else if (vim_iswordc(*p))
            {
+               has_name_start = TRUE;
                if (has_name)
                    return FALSE; /* word character after skipping past name */
                ++p;
            }
+           else if (p[0] == ':' && p[1] == ':' && vim_iswordc(p[2]))
+           {
+               if (!has_name_start || has_name)
+                   return FALSE;
+               /* C++ 17 nested namespace */
+               p += 3;
+           }
            else
            {
                return FALSE;
index c0a68d0941197126cbc03694b1a7dbb5dd478813..096f15219d60d6c3d39745850855d7202adb4336 100644 (file)
@@ -1932,6 +1932,26 @@ namespace test
 {
   111111111111111111;
 }
+namespace test::cpp17
+{
+  111111111111111111;
+}
+namespace ::incorrectcpp17
+{
+  111111111111111111;
+}
+namespace test::incorrectcpp17::
+{
+  111111111111111111;
+}
+namespace test:incorrectcpp17
+{
+  111111111111111111;
+}
+namespace test:::incorrectcpp17
+{
+  111111111111111111;
+}
 namespace{
   111111111111111111;
 }
index c4c01a3d4f00ef99487fc143b654de84d13d9f9c..2f9572cc1323f913fea79f4ebc82c2f0fad5cc76 100644 (file)
@@ -1730,6 +1730,26 @@ namespace test
 {
 111111111111111111;
 }
+namespace test::cpp17
+{
+111111111111111111;
+}
+namespace ::incorrectcpp17
+{
+       111111111111111111;
+}
+namespace test::incorrectcpp17::
+{
+       111111111111111111;
+}
+namespace test:incorrectcpp17
+{
+       111111111111111111;
+}
+namespace test:::incorrectcpp17
+{
+       111111111111111111;
+}
 namespace{
 111111111111111111;
 }
index f07437de9598979a62075dd4cd9160906681150f..5db35abc2281a95bbb59bba377eec43bc284ac00 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    92,
 /**/
     91,
 /**/