Skip to content

Warnings when compiling with -ffinite-math-only on Linux with Clang v19.1 #241

@theakman2

Description

@theakman2
  • TOML++ version: v3.4.0
  • Compiler: clang++ v19.1.1
  • Target arch: x64
  • Library configuration overrides: None
  • Relevant compilation flags:

You can run the following command on the generated all-in-one toml.hpp file using Clang 19.1:

$ clang++ -ffinite-math-only -fsyntax-only toml.hpp
  • Bug:

When compiling, you get the following warnings:

a@a:/nt$ clang++ -ffinite-math-only -fsyntax-only toml.hpp
/nt/vendor/toml++/toml.hpp:13012:30: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
 13012 |                         return inf ? (negative ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity())
       |                                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nt/vendor/toml++/toml.hpp:13012:72: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
 13012 |                         return inf ? (negative ? -std::numeric_limits<double>::infinity() : std::numeric_limits<double>::infinity())
       |                                                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.

Ideally, the parser should generate a parse error on encountering an Inf/NaN when compiling with -ffinite-math-only.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions