public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++
@ 2020-06-08 22:58 kevin at arilabs dot net
  2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kevin at arilabs dot net @ 2020-06-08 22:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95592

            Bug ID: 95592
           Summary: Collision with struct _Cosh when Cross compiling
                    libstdc++
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kevin at arilabs dot net
  Target Milestone: ---

I am cross compiling gcc 8.3.0 for QNX 6.6. While doing so,
libstdc++-v3/include/bits/valarray_after.h was having trouble with "struct
_Cosh" defined in valarray_before.h because it was colliding with the function
_Cosh() is defined in one of the target OS's headers.

Specifically it was having trouble with (around line 445 of valarray_after.h):

   _DEFINE_EXPR_UNARY_FUNCTION(cosh, _Cosh)

The compiler was using the function declaration of _Cosh instead of struct
_Cosh.

There were other _DEFINE_EXPR_UNARY_FUNCTION that had the same issue (I don't
remember which ones as I focused on _Cosh). 

Below is a patch to valarray_after.h that fixes the issue.  I'm pretty sure QNX
may be the only target OS with this problem, so I am content if this doesn't
make it in gcc, but thought that perhaps removing ambiguity from the preceding
template definitions wouldn't be bad.

I took a look at gcc 9 and 10 code base and the issue appears to exist there as
well.

Thanks
Kevin


Index: libstdc++-v3/include/bits/valarray_after.h
===================================================================
--- libstdc++-v3/include/bits/valarray_after.h  (revision 1469)
+++ libstdc++-v3/include/bits/valarray_after.h  (working copy)
@@ -422,20 +422,20 @@

 #define _DEFINE_EXPR_UNARY_FUNCTION(_Name, _UName)                       \
   template<class _Dom>                                                   \
-    inline _Expr<_UnClos<_UName, _Expr, _Dom>,                           \
+    inline _Expr<_UnClos<struct _UName, _Expr, _Dom>,                         
 \
                  typename _Dom::value_type>                              \
     _Name(const _Expr<_Dom, typename _Dom::value_type>& __e)             \
     {                                                                    \
       typedef typename _Dom::value_type _Tp;                             \
-      typedef _UnClos<_UName, _Expr, _Dom> _Closure;                     \
+      typedef _UnClos<struct _UName, _Expr, _Dom> _Closure;                   
 \
       return _Expr<_Closure, _Tp>(_Closure(__e()));                      \
     }                                                                    \
                                                                          \
   template<typename _Tp>                                                 \
-    inline _Expr<_UnClos<_UName, _ValArray, _Tp>, _Tp>                   \
+    inline _Expr<_UnClos<struct _UName, _ValArray, _Tp>, _Tp>                 
 \
     _Name(const valarray<_Tp>& __v)                                      \
     {                                                                    \
-      typedef _UnClos<_UName, _ValArray, _Tp> _Closure;                  \
+      typedef _UnClos<struct _UName, _ValArray, _Tp> _Closure;                
 \
       return _Expr<_Closure, _Tp>(_Closure(__v));                        \
     }

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

end of thread, other threads:[~2021-03-29 20:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-08 22:58 [Bug libstdc++/95592] New: Collision with struct _Cosh when Cross compiling libstdc++ kevin at arilabs dot net
2020-06-08 23:01 ` [Bug libstdc++/95592] " kevin at arilabs dot net
2020-06-08 23:02 ` kevin at arilabs dot net
2020-10-28 12:50 ` cvs-commit at gcc dot gnu.org
2020-10-28 12:51 ` redi at gcc dot gnu.org
2021-03-29 20:01 ` cvs-commit at gcc dot gnu.org
2021-03-29 20:03 ` redi at gcc dot gnu.org

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