Takayuki Shimizukawa avatar Takayuki Shimizukawa committed 6e6813e

fix: cpp domain parser cannot parse 'static constexpr' declarations. closes #1038

Comments (0)

Files changed (2)

sphinx/domains/cpp.py

         visibility = 'public'
         if self.match(_visibility_re):
             visibility = self.matched_text
-        static = self.skip_word('static')
+        static = self.skip_word_and_ws('static')
         return visibility, static
 
     def parse_type(self):

tests/test_cpp_domain.py

     x = 'constexpr int get_value()'
     assert unicode(parse('function', x)) == x
 
+    x = 'static constexpr int get_value()'
+    assert unicode(parse('function', x)) == x
+
     x = 'int get_value() const noexcept'
     assert unicode(parse('function', x)) == x
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.