My favorites | Sign in
Project Home Issues
New issue   Search
  Advanced search   Search tips   Subscriptions
Issue 66668: NDK r9d libc++: compiler error when calling std::feof(), etc.
3 people starred this issue and may be notified of changes. Back to list
Reported by, Mar 5, 2014
Issue: Compiling below translation unit using Clang/libc++ distributed with NDK r9d results in a compiler error.

* Relevant parts of
APP_STL := c++_static

* The test translation unit (TEST.cpp):

#include <cstdio>
int foo()
	std::FILE* fp;
	return std::feof(fp) ? 1 : 0;

* The compiler error:

TEST.cpp:5:15: error: expected unqualified-id
 return std::(((fp)->_flags & 0x0020) != 0) ? 1 : 0;

This happens because $NDK_DIR/sources/cxx-stl/llvm-libc++/libcxx/include/cstdio includes <stdio.h>, which itself (located in $NDK_DIR/platforms/android-XX/arch-arm/usr/include/) defines feof() and other C functions (e.g. ferror(), clearerr(), fileno(), getc(), ...) as macros.
These macros are then extended to the above line, which, in combination with the std:: namespace prefix, does not result in a valid expression.

Expected result: calls to std::feof(), etc. compile correctly.
Mar 5, 2014
Project Member #1
looks cstdio needs to #undef these macros after "capturing" them.
Mar 6, 2014
Project Member #2
Fixed by Carl's patch ( #33) which is submitted on his behalf:  

Status: FutureRelease
Jul 17, 2014
Project Member #3
(No comment was entered for this change.)
Status: Released
Sign in to add a comment

Powered by Google Project Hosting