https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70529

            Bug ID: 70529
           Summary: Unhelpful diagnostic for hex float literals,
                    inconsistent parsing
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: g...@axel-naumann.de
  Target Milestone: ---

auto d = 0x123p-2;

with g++ prog.cc -Wall -Wextra -std=c++14 -fsyntax-only

produces

prog.cc:1:10: error: exponent has no digits
 auto d = 0x123p-2;
          ^~~~~~

That's a gross misrepresentation of the source code ;-) IIUC
https://github.com/gcc-mirror/gcc/commit/14c36b1402b82304739e865a27cb1aed0d87ec73
removed hex float literal support for c++ std <= 14, making this code
ill-formed. 

OTOH this behavior is inconsistent, in that hex float literals with positive
exponents remain valid, even for above invocation.



A more helpful diagnostic (similar to "use of C++1z hexadecimal floating
constant") would be really good to have for people upgrading to GCC 6 without
also upgrading to c++1z. At least for those people with hex floats with
negative exponents :-)

Thanks for considering!

Axel.

Reply via email to