This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/70529] Unhelpful diagnostic for hex float literals, inconsistent parsing
- From: "manu at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 07 Apr 2016 21:57:08 +0000
- Subject: [Bug c++/70529] Unhelpful diagnostic for hex float literals, inconsistent parsing
- Auto-submitted: auto-generated
- References: <bug-70529-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70529
--- Comment #8 from Manuel LÃpez-IbÃÃez <manu at gcc dot gnu.org> ---
(In reply to Axel Naumann from comment #2)
> You asked for it, so here is my wish list:
> - for C++ < 1z, do not support hexfloats, neither with "unsigned" not
> negative exponents.
Since "unsigned" exponents are supported by standard C++11, g++ has to support
them.
> Or support both, as a GCC extention that's enabled by
> default - like in the GCC 5 times.
Given Joseph comments, it seems the "signed" extension is incompatible with
standard C++ < 1z. That is, the same valid program may behave differently
whether the extension is enabled or not.
> - if you remove support for C++ < 1z, state that hexfloats are unsupported
> in C++ < 1z.
Only "signed" exponents are unsupported. My patch above tries to catch this
case and give a better error message, but it is not as trivial as I thought.
> NB: Even if I would buy into the argument that diagnostics are limited by
> the tokens, I don't yet see why 'P' ends up being concated to the pp-number
> token in C++ < 1z.
You have to run g++ (actually, cc1plus) under a debugger to see why. See
lex_number. Doing it in a different way would probably break a lot of other
things.