public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64
@ 2020-10-19  6:27 brechtsanders at users dot sourceforge.net
  2020-10-19  8:04 ` [Bug libstdc++/97484] " rguenth at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: brechtsanders at users dot sourceforge.net @ 2020-10-19  6:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97484
           Summary: typedef conflict for "byte" in GCC11 for MinGW-w64
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: brechtsanders at users dot sourceforge.net
  Target Milestone: ---

I just built GCC11 snapshot 20201011 for the MinGW-w64 platform and noticed
that some things won't build with it because "byte" now has conflicting
definitions.
Windows seems to already define this in rpcndr.h, which is included from
windows.h.
But it's also defined in C++' cpp_type_traits.

The errors below are from an attempt to compile Ninja with GCC11 snapshot
20201011.

These issues were not present with GCC 11 or lower.

In file included from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\wtypes.h:8,
                 from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\winscard.h:10,
                 from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\windows.h:97,
                 from .\src\disk_interface.cc:27:
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\rpcndr.h:64:11: error:
reference to 'byte' is ambiguous
   64 |   typedef byte cs_byte;
      |           ^~~~
In file included from
d:\prog\winlibs32_stage\mingw32\include\c++\11.0.0\bits\stl_algobase.h:61,
                 from
d:\prog\winlibs32_stage\mingw32\include\c++\11.0.0\bits\stl_tree.h:63,
                 from
d:\prog\winlibs32_stage\mingw32\include\c++\11.0.0\map:60,
                 from .\src\disk_interface.h:18,
                 from .\src\disk_interface.cc:15:
d:\prog\winlibs32_stage\mingw32\include\c++\11.0.0\bits\cpp_type_traits.h:404:30:
note: candidates are: 'enum class std::byte'
  404 |   enum class byte : unsigned char;
      |                              ^~~~
In file included from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\wtypes.h:8,
                 from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\winscard.h:10,
                 from
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\windows.h:97,
                 from .\src\disk_interface.cc:27:
d:\prog\winlibs32_stage\mingw32\i686-w64-mingw32\include\rpcndr.h:63:25: note: 
               'typedef unsigned char byte'
   63 |   typedef unsigned char byte;
      |                         ^~~~

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
@ 2020-10-19  8:04 ` rguenth at gcc dot gnu.org
  2020-10-19  8:26 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-19  8:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++
             Target|                            |x86_64-MinGW-W64

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess there needs to be a workaround on the windows side?

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
  2020-10-19  8:04 ` [Bug libstdc++/97484] " rguenth at gcc dot gnu.org
@ 2020-10-19  8:26 ` jakub at gcc dot gnu.org
  2020-10-19  9:39 ` brechtsanders at users dot sourceforge.net
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-19  8:26 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Does Ninja use
using namespace std;
before including standard headers, or does some mingw header use that?

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
  2020-10-19  8:04 ` [Bug libstdc++/97484] " rguenth at gcc dot gnu.org
  2020-10-19  8:26 ` jakub at gcc dot gnu.org
@ 2020-10-19  9:39 ` brechtsanders at users dot sourceforge.net
  2020-10-19  9:45 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: brechtsanders at users dot sourceforge.net @ 2020-10-19  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Brecht Sanders <brechtsanders at users dot sourceforge.net> ---
MinGW is pure C, so it doesn't use: using namespace std;
But I do see Ninja doing this before including windows.h.
However GCC 10 and older have no issue with this.
What changed in GCC 11 to cause the issue?

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
                   ` (2 preceding siblings ...)
  2020-10-19  9:39 ` brechtsanders at users dot sourceforge.net
@ 2020-10-19  9:45 ` jakub at gcc dot gnu.org
  2020-10-19 10:09 ` brechtsanders at users dot sourceforge.net
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-19  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Brecht Sanders from comment #3)
> MinGW is pure C, so it doesn't use: using namespace std;
> But I do see Ninja doing this before including windows.h.

Then it is Ninja that needs to be fixed.  One can use using namespace std;,
but better only after including all headers one has no control over, because it
significantly affects name lookup.

> However GCC 10 and older have no issue with this.
> What changed in GCC 11 to cause the issue?

GCC 11 defaults to -std=c++17, while GCC 10 defaulted to -std=c++14.
I bet it won't compile even with GCC 10 if you use -std=c++17.

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
                   ` (3 preceding siblings ...)
  2020-10-19  9:45 ` jakub at gcc dot gnu.org
@ 2020-10-19 10:09 ` brechtsanders at users dot sourceforge.net
  2020-10-19 10:20 ` jakub at gcc dot gnu.org
  2023-03-14 21:13 ` Abderraouf.bousri at g dot enp.edu.dz
  6 siblings, 0 replies; 8+ messages in thread
From: brechtsanders at users dot sourceforge.net @ 2020-10-19 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

Brecht Sanders <brechtsanders at users dot sourceforge.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Brecht Sanders <brechtsanders at users dot sourceforge.net> ---
Yes, you're right, when setting CXXFLAGS="-std=c++17" and building with GCC 10
Ninja also fails to build.

I have opened a ticket with Ninja for this, see:
https://github.com/ninja-build/ninja/issues/1861

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
                   ` (4 preceding siblings ...)
  2020-10-19 10:09 ` brechtsanders at users dot sourceforge.net
@ 2020-10-19 10:20 ` jakub at gcc dot gnu.org
  2023-03-14 21:13 ` Abderraouf.bousri at g dot enp.edu.dz
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-10-19 10:20 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |INVALID

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

* [Bug libstdc++/97484] typedef conflict for "byte" in GCC11 for MinGW-w64
  2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
                   ` (5 preceding siblings ...)
  2020-10-19 10:20 ` jakub at gcc dot gnu.org
@ 2023-03-14 21:13 ` Abderraouf.bousri at g dot enp.edu.dz
  6 siblings, 0 replies; 8+ messages in thread
From: Abderraouf.bousri at g dot enp.edu.dz @ 2023-03-14 21:13 UTC (permalink / raw)
  To: gcc-bugs

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

Abderraouf Bousri <Abderraouf.bousri at g dot enp.edu.dz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Abderraouf.bousri at g dot enp.edu
                   |                            |.dz

--- Comment #6 from Abderraouf Bousri <Abderraouf.bousri at g dot enp.edu.dz> ---
yes you are right, it was generating that error when i tried to compile with
those configurations :

CMAKE_CXX_STANDARD 17   and g++ (8.0, 9.0, 10.0 and 12), also i tried with
visual studio and Ninja.

i changed the flag to c++14, now it works (with g++ 8.0) :
    set(CMAKE_CXX_STANDARD 14)  #in your CMakeLists.txt
run this cmake command on windows : 
    cmake -G "MinGW Makefiles" -D CMAKE_CXX_COMPILER=g++ ..

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

end of thread, other threads:[~2023-03-14 21:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-19  6:27 [Bug c++/97484] New: typedef conflict for "byte" in GCC11 for MinGW-w64 brechtsanders at users dot sourceforge.net
2020-10-19  8:04 ` [Bug libstdc++/97484] " rguenth at gcc dot gnu.org
2020-10-19  8:26 ` jakub at gcc dot gnu.org
2020-10-19  9:39 ` brechtsanders at users dot sourceforge.net
2020-10-19  9:45 ` jakub at gcc dot gnu.org
2020-10-19 10:09 ` brechtsanders at users dot sourceforge.net
2020-10-19 10:20 ` jakub at gcc dot gnu.org
2023-03-14 21:13 ` Abderraouf.bousri at g dot enp.edu.dz

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