Skip to content

incorrect implementation of isnan and similar functions #18592

@llvmbot

Description

@llvmbot
Bugzilla Link 18218
Version unspecified
OS All
Depends On #18759
Reporter LLVM Bugzilla Contributor
CC @dlj-NaN,@eugenis,@K-ballo,@mclow,@zygoloid,@seanm

Extended Description

The standard specifies in [c.math] that isnan and other classification functions must have the following overloads:

bool isnan(float x);
bool isnan(double x);
bool isnan(long double x);

Implementing it as a template seems like a good idea, except that the following valid code is rejected:

#include

struct A {
operator float() { return 0.0; }
};

int main() {
std::isnan(A());
}

The template should be enabled for every type that is convertible to an arithmetic type, to make the implementation indistinguishable from what is specified in the standard.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillalibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions