On my eglibc 2.13 based Debian system 'getc' is a macro defined in /usr/include/stdio.h. This decision to make it a macro doesn't seem to be guarded by any feature test macro as far as I can see:
/* The C standard explicitly says this is a macro, so we always do the
optimization for it. */
#define getc(_fp) _IO_getc (_fp)
The same is true for 'putc'.
Having theses as macros breaks
test/input.output/file.streams/c.files/cstdio.pass.cpp:
test/input.output/file.streams/c.files/cstdio.pass.cpp:119:47: error:
no member named '_IO_getc' in namespace 'std'
static_assert((std::is_same<decltype(std::getc(fp)), int>::value), "");
~~~~~^
/usr/include/stdio.h:545:19: note: expanded from macro 'getc'
#define getc(_fp) _IO_getc (_fp)
and:
input.output/file.streams/c.files/cstdio.pass.cpp:122:47: error: no
member named '_IO_putc' in namespace 'std'
static_assert((std::is_same<decltype(std::putc(0,fp)), int>::value), "");
~~~~~^
/usr/include/stdio.h:587:24: note: expanded from macro 'putc'
#define putc(_ch, _fp) _IO_putc (_ch, _fp)
I've attached a patch that fixes this by adding __libcpp_ style shims
for getc and putc at global scope in include/cstdio. If there is a way
to avoid needing to do this or a better approach I'm all for it.
Thanks,
Andrew
libc++.stdio.getc.putc.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
