Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong return type for std::isinf/isnan(double) #13367

Open
7 of 8 tasks
ZzEeKkAa opened this issue Apr 6, 2024 · 0 comments
Open
7 of 8 tasks

Wrong return type for std::isinf/isnan(double) #13367

ZzEeKkAa opened this issue Apr 6, 2024 · 0 comments
Labels

Comments

@ZzEeKkAa
Copy link

ZzEeKkAa commented Apr 6, 2024

Checklist

  • I added a descriptive title.
  • I searched through existing issues and couldn't find a solution or duplicate issue.
  • I searched on the web (e.g. Google) and didn't find any helpful information.
  • I searched the Anaconda documentation and didn't find any helpful information.

Impacted product

  • A conda package (built by Anaconda)
  • Anaconda Distribution (formerly Anaconda Individual Edition)
  • Miniconda
  • Anaconda.org

What happened?

#include <cmath>

#include <type_traits>

// this one works as expected
static_assert(
  std::is_same_v < decltype(std::isinf(std::declval < float > ())), bool > );

// this works, but should not
static_assert(
  std::is_same_v < decltype(std::isinf(std::declval < double > ())), int > );

// this one does not work, but should
static_assert(
  std::is_same_v < decltype(std::isinf(std::declval < double > ())), bool > );

cpp reference (https://en.cppreference.com/w/cpp/numeric/math/isinf):

bool isinf( float num );
bool isinf( double num );
bool isinf( long double num );

To create environment:

conda create -n compiler -c defaults --override-channels gxx_linux-64 gcc_linux-64
conda activate compiler
x86_64-conda-linux-gnu-g++ --sysroot=${CONDA_BUILD_SYSROOT} -c test.hpp

Exact error:

test.hpp:15:8: error: static assertion failed
   15 |   std::is_same_v < decltype(std::isinf(std::declval < double > ())), bool > );
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expected behavior or outcome

Return type of std::isinf(double); must bool, not int

Conda info

active environment : compiler
    active env location : /home/yevhenii/.miniconda3/envs/compiler
            shell level : 1
       user config file : /home/yevhenii/.condarc
 populated config files : /home/yevhenii/.condarc
          conda version : 24.3.0
    conda-build version : 24.3.0
         python version : 3.10.12.final.0
                 solver : libmamba (default)
       virtual packages : __archspec=1=skylake
                          __conda=24.3.0=0
                          __glibc=2.35=0
                          __linux=5.15.123.1=0
                          __unix=0=0
       base environment : /home/yevhenii/.miniconda3  (writable)
      conda av data dir : /home/yevhenii/.miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/yevhenii/.miniconda3/pkgs
                          /home/yevhenii/.conda/pkgs
       envs directories : /home/yevhenii/.miniconda3/envs
                          /home/yevhenii/.conda/envs
               platform : linux-64
             user-agent : conda/24.3.0 requests/2.31.0 CPython/3.10.12 Linux/5.15.123.1-microsoft-standard-WSL2 ubuntu/22.04.4 glibc/2.35 solver/libmamba conda-libmamba-solver/24.1.0 libmambapy/1.5.8
                UID:GID : 1000:1000
             netrc file : /home/yevhenii/.netrc
           offline mode : False

Conda config

==> /home/yevhenii/.condarc <==
auto_activate_base: False
channel_priority: disabled
channels:
  - defaults
report_errors: False
conda-build:
  pkg_format: 2

Conda list

# packages in environment at /home/yevhenii/.miniconda3/envs/compiler:
#
# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                        main    defaults
_openmp_mutex             5.1                       1_gnu    defaults
_sysroot_linux-64_curr_repodata_hack 3                   haa98f57_10    defaults
binutils_impl_linux-64    2.38                 h2a08ee3_1    defaults
binutils_linux-64         2.38.0               hc2dff05_0    defaults
gcc_impl_linux-64         11.2.0               h1234567_1    defaults
gcc_linux-64              11.2.0               h5c386dc_0    defaults
gxx_impl_linux-64         11.2.0               h1234567_1    defaults
gxx_linux-64              11.2.0               hc2dff05_0    defaults
kernel-headers_linux-64   3.10.0              h57e8cba_10    defaults
ld_impl_linux-64          2.38                 h1181459_1    defaults
libgcc-devel_linux-64     11.2.0               h1234567_1    defaults
libgcc-ng                 11.2.0               h1234567_1    defaults
libgomp                   11.2.0               h1234567_1    defaults
libstdcxx-devel_linux-64  11.2.0               h1234567_1    defaults
libstdcxx-ng              11.2.0               h1234567_1    defaults
sysroot_linux-64          2.17                h57e8cba_10    defaults

Additional information

Latest ubuntu 22.04 gcc package works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant