This is a completely valid code you are using the unary + operator, the result is the value of the operand, it also performs the integer promotions on the operand.
Turing on warning would have been helpful in this case, for example gcc and clang using -Wall -Wextra
would give you a warning like this:
warning: expression result unused [-Wunused-value]
+ 7;
^ ~
We can get the same warning in Visual Studio using /Wall:
warning C4555: expression has no effect; expected expression with side-effect
This is covered in the draft C++ standard section 5.3.1
Unary operators which says:
The operand of the unary + operator shall have arithmetic, unscoped
enumeration, or pointer type and the result is the value of the
argument. Integral promotion is performed on integral or enumeration
operands. The type of the result is the type of the promoted operand.
cppreference has the following to say:
The builtin unary plus operator returns the value of its operand. The
only situation where it is not a no-op is when the operand has
integral type or unscoped enumeration type, which is changed by
integral promotion, e.g, it converts char to int or if the operand is
subject to lvalue-to-rvalue, array-to-pointer, or function-to-pointer
conversion.