public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31511]  New: /usr/include/c++/bits/cmath.tcc: no match for ternary 'operator?:' in '((__n % 2u) != 0u) ? __x : 1'
@ 2007-04-08 20:03 bav dot 272304 at gmail dot com
  2007-04-08 20:12 ` [Bug libstdc++/31511] " pcarlini at suse dot de
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: bav dot 272304 at gmail dot com @ 2007-04-08 20:03 UTC (permalink / raw)
  To: gcc-bugs

It is known problem with GNU ISO C++ Library math implementation by Gabriel Dos
Reis.

g++ compiler says something like this:

        /usr/include/c++/bits/cmath.tcc:41: error: no match for
        ternary 'operator?:' in '((__n % 2u) != 0u) ? __x : 1'

It could be fixed by replacing the certain line at the cmath.tcc file

        _Tp __y = __n % 2 ? __x : 1;

with more correct

        _Tp __y = __n % 2 ? __x : _Tp(1);

(see cmath.tcc for details)

To reproduce error, try to pass to std::pow() std::complex<T> object where T
isn't primitive type but some class with arithmetic operators overloaded.

I found it in g++ 3.3.5, g++ 4.0.0, etc.


-- 
           Summary: /usr/include/c++/bits/cmath.tcc: no match for ternary
                    'operator?:' in '((__n % 2u) != 0u) ? __x : 1'
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bav dot 272304 at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31511


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2007-04-08 22:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-08 20:03 [Bug c++/31511] New: /usr/include/c++/bits/cmath.tcc: no match for ternary 'operator?:' in '((__n % 2u) != 0u) ? __x : 1' bav dot 272304 at gmail dot com
2007-04-08 20:12 ` [Bug libstdc++/31511] " pcarlini at suse dot de
2007-04-08 20:16 ` [Bug c++/31511] " bav dot 272304 at gmail dot com
2007-04-08 20:17 ` bav dot 272304 at gmail dot com
2007-04-08 20:20 ` [Bug libstdc++/31511] " pcarlini at suse dot de
2007-04-08 20:21 ` [Bug c++/31511] " bav dot 272304 at gmail dot com
2007-04-08 20:22 ` [Bug libstdc++/31511] " pcarlini at suse dot de
2007-04-08 20:53 ` gdr at cs dot tamu dot edu
2007-04-08 22:36 ` pcarlini at suse dot de
2007-04-08 22:38 ` paolo at gcc dot gnu dot org
2007-04-08 22:39 ` pcarlini at suse dot de

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).