https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96862
Bug ID: 96862 Summary: -frounding-math -std=c++2a error: '(1.29e+2 * 6.9314718055994529e-1)' is not a constant expression Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: Laurent.Rineau__gcc at normalesup dot org Target Milestone: --- Commit e6c76f0d3327bf00c96f5a63961c1d5ab77512db introduced a compilation error with `-frounding-math -std=c++2a`: it seems that, with `-frounding-math` a floating-point expression cannot be constexpr. # cat test.cpp #include <string> # g++ --version g++ (GCC) 11.0.0 20200828 (experimental) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # g++ -std=c++2a -frounding-math test.cpp In file included from /usr/local/include/c++/11.0.0/bits/range_access.h:40, from /usr/local/include/c++/11.0.0/string:54, from test.cpp:1: /usr/local/include/c++/11.0.0/bits/max_size_type.h:708:35: error: '(1.29e+2 * 6.9314718055994529e-1)' is not a constant expression 708 | = static_cast<int>(digits * numbers::ln2 / numbers::ln10); | ~~~~~~~^~~~~~~~~~~~~~ /usr/local/include/c++/11.0.0/bits/max_size_type.h:734:50: error: '(8.8722839111672997e+1 / 2.3025850929940459e+0)' is not a constant expression 734 | = static_cast<int>(digits * numbers::ln2 / numbers::ln10); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~