[Bug c++/67309] New: Error compiling with -std=c++11 and -fsingle-precision-constant
dflogeras2 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Aug 21 16:39:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67309
Bug ID: 67309
Summary: Error compiling with -std=c++11 and
-fsingle-precision-constant
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dflogeras2 at gmail dot com
Target Milestone: ---
The ARM people recommend using -fsingle-precision-constant for targeting their
microcontrollers, such as the Cortex M4. I am experimenting with using parts
of modern C++ on my uC projects.
If I compile the following (not just with arm cross compilers, even my native
linux compiler):
#include <algorithm>
int main() {}
with:
gcc test.cpp -fsingle-precision-constant -std=c++11 -c
It fails, since c++11 templating will not promote float types, and there is an
ambiguous 6.0 floating point constant in the bowels of the STL, which ends up
with a call to std::max<T>( float, double ) which is illegal.
Not sure what the proper fix is, and I'm also not sure why this used to compile
for me (same flags, gcc-4.7.3), but no longer does.
More information about the Gcc-bugs
mailing list