public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/89855] Inconsistent global namespace overload sets from #include <cmath> Date: Thu, 10 Feb 2022 09:41:21 +0000 [thread overview] Message-ID: <bug-89855-4-3kPzOQj1wZ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-89855-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89855 --- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- Ville brought a related case to my attention. With Glibc this compiles, and finds libc's ::sqrt(double) #include <cmath> int i = sqrt(0); But on Solaris it doesn't even compile. Solaris libc provides all three of sqrt(float), sqrt(double), sqrt(long double), which makes this ambiguous. The additional overload that works for integral types is not provided by Solaris libc's <math_iso.h>, only by <cmath>, and so can't be found here because there is no 'using std::sqrt;' to put it into the global namespace. So this compiles and even gives the expected result (returning a double) on linux, but fails to compile on Solaris. This suggests that we even need the additional overloads for integral arguments to be unconditionally dumped into both the global namespace and std.
next prev parent reply other threads:[~2022-02-10 9:41 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-89855-4@http.gcc.gnu.org/bugzilla/> 2020-04-29 18:25 ` foom at fuhm dot net 2020-04-29 18:27 ` foom at fuhm dot net 2020-04-29 20:46 ` redi at gcc dot gnu.org 2021-11-17 16:05 ` redi at gcc dot gnu.org 2022-02-10 9:41 ` redi at gcc dot gnu.org [this message] 2024-03-26 16:51 ` redi at gcc dot gnu.org 2024-03-26 19:37 ` redi at gcc dot gnu.org 2024-03-28 8:12 ` de34 at live dot cn
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-89855-4-3kPzOQj1wZ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).