UPDATE: That pretest version that I put down there in the original question (
emacs-26.0.90.tar.gz) had a bug that cause certain infinity loops while parsing the buffer, specifically when using the
< token in certaing contexts, like writting
< as the first character of an empty buffer in Java or C++ or after the keyword
template. The bug has been fixed in the
emacs-26 branch, so that is what you have to download instead.
It took a lot to me to find the answer and learning how to property customize the behaviour in the elisp language but, a way of fixing that is by telling to the
constexpr is a "noise name", which means that it will be treated as a whitespace and thus ignored by the parser.
The thing is that in the last stable release of emacs (25.3), the feature of adding noise words is not added, even when it is in the repo since February 2016, so you have to download the a non-release version.
sudo apt-get install build-essential # if you don't have it yet
sudo apt-get build-dep emacs24 # get all dependancies to build emacs
# Not this: wget https://github.com/emacs-mirror/emacs/archive/emacs-26.0.90.tar.gz
wget -O emacs-26.zip https://github.com/emacs-mirror/emacs/archive/e8636ac8cc96e1e7e948f04091792da09dafcc76.zip
# or just the last version of the branch, but the exact version I have is the one above
# wget https://github.com/emacs-mirror/emacs/archive/emacs-26.zip
sudo make install
And then, for example at the end of the
.emacs file, add:
; Load the mode before-hand to make the symbols visible
(custom-set-variables '(c-noise-macro-names '("constexpr")))