This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/52818] New: printf format %lf is erroneously rejected by C++11


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52818

             Bug #: 52818
           Summary: printf format %lf is erroneously rejected by C++11
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: joedoefawnbuck@googlemail.com


C99, and thus C++11, allow %lf as a synonym for %f as a printf format
specifier. However, with `-pedantic -Wformat -std=c++11`, GCC 4.7. emits a
warning:

#include <cstdio>
int main() { return std::printf("%lf", 0.0); }

warning: ISO C++ does not support the â%lfâ gnu_printf format [-Wformat]

The same holds for -std=c99 and -std=c11.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]