https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70529
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2023-08-17
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Confirmed, it's certainly confusing that this works as an extension:
$ g++ -c -std=c++14 -pedantic -x c++ /dev/stdin <<< 'auto p = 0x123p1;'
/dev/stdin:1:10: warning: use of C++17 hexadecimal floating constant
But this doesn't:
$ g++ -c -std=c++14 -pedantic -x c++ /dev/stdin <<< 'auto p = 0x123p-1;'
/dev/stdin:1:10: warning: use of C++17 hexadecimal floating constant
/dev/stdin:1:10: error: exponent has no digits
Maybe the "exponent has no digits" diagnostic could try inspecting the next
tokens, and if it finds '-' or '+' then an integer literal with no intervening
whitespace (can we tell that?), modify the diagnostic to be more informative:
error: hexadecimal floating constants with negative exponents are not supported
in C++14
We can keep the existing diagnostic for cases where there really aren't any
digits in the exponent, e.g. 0x123p * 1 and (if we can detect the presence of
whitespace between the tokens) 0x123p - 1.