public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/27340]  New: valarray uses __cos which may conflict with libm functions
@ 2006-04-27 19:00 marc dot glisse at normalesup dot org
  2006-04-27 19:07 ` [Bug libstdc++/27340] " pinskia at gcc dot gnu dot org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: marc dot glisse at normalesup dot org @ 2006-04-27 19:00 UTC (permalink / raw)
  To: gcc-bugs

valarray defines structs with names like __cos, __sin, etc. It is often the
case (glibc, solaris) that the libc declares functions with those same names.
In the current situation we are lucky because the structs are in namespace std
and the functions in the global namespace. But playing around with namespace
std soon brings something like this:

namespace std {
    double __cos(double);
    struct __cos
    {
        template<typename _Tp>
            _Tp operator()(const _Tp& __t) const;
    };
}
template <class T> struct A {};
int main(){
    A<std::__cos> a;
}

which results in:

error: type/value mismatch at argument 1 in template parameter list for
'template<class T> struct A'
error:   expected a type, got 'std::__cos'
error: invalid type in declaration before ';' token


It would be preferable to use a less conflict-prone name.


-- 
           Summary: valarray uses __cos which may conflict with libm
                    functions
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: marc dot glisse at normalesup dot org


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


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

end of thread, other threads:[~2010-02-06 22:21 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-27 19:00 [Bug libstdc++/27340] New: valarray uses __cos which may conflict with libm functions marc dot glisse at normalesup dot org
2006-04-27 19:07 ` [Bug libstdc++/27340] " pinskia at gcc dot gnu dot org
2006-04-28 10:33 ` marc dot glisse at normalesup dot org
2006-04-28 20:01 ` pcarlini at suse dot de
2006-04-28 20:43 ` marc dot glisse at normalesup dot org
2006-04-28 21:18 ` pcarlini at suse dot de
2006-04-28 21:57 ` marc dot glisse at normalesup dot org
2006-05-01 23:40 ` gdr at integrable-solutions dot net
2010-02-05 13:07 ` paolo dot carlini at oracle dot com
2010-02-06 17:52 ` marc dot glisse at normalesup dot org
2010-02-06 19:07 ` paolo dot carlini at oracle dot com
2010-02-06 19:18 ` gdr at gcc dot gnu dot org
2010-02-06 19:43 ` paolo dot carlini at oracle dot com
2010-02-06 19:43 ` paolo dot carlini at oracle dot com
2010-02-06 20:41 ` paolo at gcc dot gnu dot org
2010-02-06 20:44 ` paolo dot carlini at oracle dot com
2010-02-06 22:21 ` gdr at integrable-solutions dot net

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