Skip to content

Compilation with GCC < 9.0 #8

@philippefoubert

Description

@philippefoubert

With GCC < 9.0, the bug 67371 - Never executed "throw" in constexpr function fails to compile gives errors.

It has been solved for GCC >= 9.0 with 86678 - constexpr evaluation incorrectly diagnoses unevaluated call to non-constexpr function.

A workaround is to add in "cx_math.h":

// GCC
//  Bug 67371 - Never executed "throw" in constexpr function fails to compile
//  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86678
//  Fixed for GCC 9.
#if defined(__GNUC__) && (__GNUC__ < 9)
#  define BUG_67371
#endif

and modify the constexpr long double floor(long double x) and constexpr long double ceil(long double x) functions the following way:

[...]
#ifndef BUG_67371
  throw err::ceil_runtime_error();
#endif  // BUG_67371
[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions