------- Comment #3 from gdr at cs dot tamu dot edu 2006-01-22 20:42 ------- Subject: Re: Client's isnormal function is broken by cmath
"hhinnant at apple dot com" <[EMAIL PROTECTED]> writes: | (In reply to comment #1) | > | > Does the problem exist if you configure with --disable-c99? | | I haven't tried that configuration. The docs say that setting may change | libstdc++'s ABI. Indeed. The question was to what extent the issue is completely fixable. | So this is expected behavior for the default configuration? if you keep ADL and template deduction, sort of :-) This is the error I get: /home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath: In function 'int __gnu_cxx::__capture_isnormal(_Tp) [with _Tp = manager]': /home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:537: instantiated from 'int std::isnormal(_Tp) [with _Tp = manager]' t.C:22: instantiated from here /home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466: error: cannot convert 'manager' to 'long double' for argument '1' to 'int __fpclassifyl(long double)' /home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466: error: cannot convert 'manager' to 'double' for argument '1' to 'int __fpclassify(double)' /home/gdr/lib/gcc/i686-pc-linux-gnu/4.2.0/../../../../include/c++/4.2.0/cmath:466: error: cannot convert 'manager' to 'float' for argument '1' to 'int __fpclassifyf(float)' which shows that std::isnormal is being used -- because it provides a better match. Two issues here: (1) the std::isnormal template is way too liberal -- probably needs an enable-if decoration. (2) std::isnormal is there only if C99 is enabled with a compbination of C99 macro dynamic. See the contrived logic in std_cmath.h. (3) even when isnormal is enable-if hacked, you still potentially run into the same problem. -- Gaby -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25913