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

            Bug ID: 111824
           Summary: [14 Regression]  <limits> is invalid under
                    -U__STRICT_ANSI__ -std=c++11
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

I think it's a regression started from r14-1433-gf150a084e25eaa

Noticed on `monotone-1.1` source code where `monotone` uses `#undef
__STRICT_ANSI__` for some reason. As a result build fails as:


$ printf "#include <limits>" | g++ -c -x c++ - -U__STRICT_ANSI__ -std=c++11 -o
/dev/null |& head -n 10
In file included from /<<NIX>>/gcc-14.0.0/include/c++/14.0.0/limits:42,
                 from <stdin>:1:
/<<NIX>>/gcc-14.0.0/include/c++/14.0.0/x86_64-unknown-linux-gnu/bits/c++config.h:668:2:
warning: #warning "__STRICT_ANSI__ seems to have been undefined; this is not
supported" [-Wcpp]
  668 | #warning "__STRICT_ANSI__ seems to have been undefined; this is not
supported"
      |  ^~~~~~~
/<<NIX>>/gcc-14.0.0/include/c++/14.0.0/limits:2100:30: error: exponent has no
digits
 2100 |         return __extension__ 0x1.0p-16382Q;
      |                              ^~~~~~
/<<NIX>>/gcc-14.0.0/include/c++/14.0.0/limits:2114:30: error: exponent has no
digits
 2114 |         return __extension__ 0x1.ffffffffffffffffffffffffffffp+16383Q;


AFAIU it's caused by the code like

    #ifdef __STRICT_ANSI__
        // 0x1.0p-30 * 0x1.0p-16352
        return double(9.3132257461547852e-10) * _S_1pm16352();
    #else
        return __extension__ 0x1.0p-16382Q;
    #endif

Note that -std=gnu++11 does work.

I'm not sure if it's a user error to unset `__STRICT_ANSI__` and expect
libstdc++ to use only supported extensions. Filing the bug just in case.

Reply via email to