public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/97362] New: __deref in <functional> in debug mode clashes with Windows SDK internal macro
@ 2020-10-10 10:37 frankhb1989 at gmail dot com
  2020-10-10 11:05 ` [Bug libstdc++/97362] `__deref` in <functional> in debug mode clashes with internal macro in Windows system header frankhb1989 at gmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: frankhb1989 at gmail dot com @ 2020-10-10 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97362
           Summary: __deref in <functional> in debug mode clashes with
                    Windows SDK internal macro
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frankhb1989 at gmail dot com
  Target Milestone: ---

Case:

#include <windows.h>
#include <functional>

int main()
{}

/tmp $ g++ -D_GLIBCXX_DEBUG a.cc
In file included from F:/msys64/mingw64/include/c++/10.2.0/debug/debug.h:133,
                 from
F:/msys64/mingw64/include/c++/10.2.0/bits/stl_algobase.h:69,
                 from F:/msys64/mingw64/include/c++/10.2.0/array:40,
                 from F:/msys64/mingw64/include/c++/10.2.0/tuple:39,
                 from F:/msys64/mingw64/include/c++/10.2.0/functional:54,
                 from a.cc:2:
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:424:15: error: expected
unqualified-id before ')' token
  424 |       __deref();
      |               ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:34: error: expected
primary-expression before '<' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                  ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:38: error: expected
primary-expression before '>' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                      ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:40: error: expected
primary-expression before ')' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                        ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:51: error: expected
primary-expression before '<' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                                   ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:55: error: expected
primary-expression before '>' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                                       ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:427:57: error: expected
primary-expression before ')' token
  427 |       typename = decltype(__deref<_It>() < __deref<_It>())>
      |                                                         ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:42: error: expected
primary-expression before '<' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
      |                                          ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:46: error: expected
primary-expression before '>' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
      |                                              ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:48: error: expected
primary-expression before ')' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
      |                                                ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:58: error: expected
primary-expression before '<' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
      |                                                          ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:62: error: expected
primary-expression before '>' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>
      |                                                              ^
F:/msys64/mingw64/include/c++/10.2.0/debug/functions.h:441:64: error: expected
primary-expression before ')' token
  441 |  = decltype(std::declval<_Pred>()(__deref<_It>(), __deref<_It>()))>

This is reproducible with MSYS2's {i686, x86_64}-w64-mingw32-g++. Note it
compiles without -D_GLIBCXX_DEBUG.

The offending `__deref` is from WinSDK header <sal.h> (also available in
mingw-w64 for compatibility). As a system header, it is legitimate to have
reserved identifiers. Although the workaround is simple (by #undef, since
<specstrings_undef.h> is not available in mingw-w64 yet), it is still annoying
and confusing. It seems a quick workaround by avoiding using `__deref` here is
more appropriate.

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

end of thread, other threads:[~2021-04-19 10:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-10 10:37 [Bug libstdc++/97362] New: __deref in <functional> in debug mode clashes with Windows SDK internal macro frankhb1989 at gmail dot com
2020-10-10 11:05 ` [Bug libstdc++/97362] `__deref` in <functional> in debug mode clashes with internal macro in Windows system header frankhb1989 at gmail dot com
2020-10-10 11:15 ` [Bug libstdc++/97362] [8/9/10/11 Regression] " redi at gcc dot gnu.org
2020-10-10 11:17 ` redi at gcc dot gnu.org
2020-10-10 12:42 ` redi at gcc dot gnu.org
2020-10-10 12:54 ` redi at gcc dot gnu.org
2020-10-28 13:27 ` [Bug libstdc++/97362] [8/9/10 " redi at gcc dot gnu.org
2020-11-04 14:00 ` redi at gcc dot gnu.org
2020-11-23 11:23 ` redi at gcc dot gnu.org
2021-02-17 17:10 ` frankhb1989 at gmail dot com
2021-02-17 19:04 ` redi at gcc dot gnu.org
2021-04-08 14:21 ` redi at gcc dot gnu.org
2021-04-19 10:26 ` [Bug libstdc++/97362] [8/9 " cvs-commit at gcc dot gnu.org
2021-04-19 10:26 ` cvs-commit at gcc dot gnu.org
2021-04-19 10:27 ` 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).