Repository: sphinx-doc/sphinx

Issue:
C++: Does warn about constants having `8` in the hexadecimal value
Sphinx with breathe warns about constants which have the value `0x08`.

**To Reproduce**
Steps to reproduce the behavior:
```
$ git clone https://github.com/jakobandersen/breathe
$ git checkout --track origin sphinx-2.0
$ # Apply the following patch
```

```diff
$ git diff examples/
diff --git a/examples/doxygen/func.h b/examples/doxygen/func.h
index 5f29f65..edd19d9 100644
--- a/examples/doxygen/func.h
+++ b/examples/doxygen/func.h
@@ -19,3 +19,5 @@ const char *Test6::member(char c,int n) throw(std::out_of_range) {}
  *  \exception std::out_of_range parameter is out of range.
  *  \return a character pointer.
  */
+
+const int constant = 0x08;
```

```
$ make >& output
$ grep -C 1 constant output.log
```

```
E:\projekte\breathe\documentation\source\doxygen.rst:34: WARNING: Invalid definition: Expected end of definition. [error at 24]
  const int constant = 0x08
  ------------------------^
```

**Expected behavior**
no warning

**Environment info**
- OS: Win 7
- Python version: 3.6.2
- Sphinx version: 2.0.1
- Sphinx extensions:  breathe using sphinx 2.0 support branch

Discussion:

Patch:
diff --git a/CHANGES b/CHANGES
index e6ce5f9e8..259dd20be 100644
--- a/CHANGES
+++ b/CHANGES
@@ -16,6 +16,8 @@ Features added
 Bugs fixed
 ----------
 
+* #6286: C++, allow 8 and 9 in hexadecimal integer literals.
+
 Testing
 --------
 
diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py
index 03e91bcee..dcc798190 100644
--- a/sphinx/domains/cpp.py
+++ b/sphinx/domains/cpp.py
@@ -292,7 +292,7 @@
 
 _integer_literal_re = re.compile(r'[1-9][0-9]*')
 _octal_literal_re = re.compile(r'0[0-7]*')
-_hex_literal_re = re.compile(r'0[xX][0-7a-fA-F][0-7a-fA-F]*')
+_hex_literal_re = re.compile(r'0[xX][0-9a-fA-F][0-9a-fA-F]*')
 _binary_literal_re = re.compile(r'0[bB][01][01]*')
 _integer_suffix_re = re.compile(r'')
 _float_literal_re = re.compile(r'''(?x)


Test patch:
diff --git a/tests/test_domain_cpp.py b/tests/test_domain_cpp.py
index d6470dc7c..c81d66b17 100644
--- a/tests/test_domain_cpp.py
+++ b/tests/test_domain_cpp.py
@@ -114,7 +114,7 @@ def exprCheck(expr, id, id4=None):
     exprCheck('nullptr', 'LDnE')
     exprCheck('true', 'L1E')
     exprCheck('false', 'L0E')
-    ints = ['5', '0', '075', '0xF', '0XF', '0b1', '0B1']
+    ints = ['5', '0', '075', '0x0123456789ABCDEF', '0XF', '0b1', '0B1']
     unsignedSuffix = ['', 'u', 'U']
     longSuffix = ['', 'l', 'L', 'll', 'LL']
     for i in ints: