public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library
@ 2013-11-01  2:51 michael at talamasca dot ocis.net
  2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: michael at talamasca dot ocis.net @ 2013-11-01  2:51 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58952
           Summary: Construct "std::getchar()" rejected when getchar is
                    macro in C library
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michael at talamasca dot ocis.net

On my system, the following C++ code refuses to compile:

#include <cstdio>

int foo (void)
{
     return std::getchar();
}

The immediate cause is that getchar() is a macro in my underlying C library
(uClibc-0.9.33.2).  Changing it to (std::getchar)() works.

Looking at the /usr/include/c++/4.8.2/cstdio file, there are a number of #undef
directives apparently intended to prevent similar problems with other stdio
functions.  But there is no #undef for getchar.


GNU automake's test suite uses this construct as part of a test to make sure
that a C++ file generated using yacc actually reaches a C++ compiler and not a
C one.


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

end of thread, other threads:[~2013-11-01 11:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-01  2:51 [Bug libstdc++/58952] New: Construct "std::getchar()" rejected when getchar is macro in C library michael at talamasca dot ocis.net
2013-11-01 10:36 ` [Bug libstdc++/58952] " redi at gcc dot gnu.org
2013-11-01 10:36 ` redi at gcc dot gnu.org
2013-11-01 10:48 ` paolo.carlini at oracle dot com
2013-11-01 11:11 ` paolo at gcc dot gnu.org
2013-11-01 11:17 ` paolo.carlini at oracle dot com
2013-11-01 11:17 ` paolo 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).