clang finds errors in its own header files

I am writing a parser for c++.

I am developing on a Mac. OS X Sierra 10.12.1

I am frustrated by the fact that I cannot compile even the simplest c++ code because clang 3.9 finds errors in the clang headers themselves! for example:

#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Frontend/ASTConsumers.h"
#include "clang/Frontend/FrontendActions.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/Support/raw_ostream.h"
#include <string>
#include <memory>

int main( void )
{
     return 0;
}

Hi Paul:

Why are you explicitly including …/c++/4.2.1?

If clang was compiled correctly, it should be able to find it’s own c++ headers – on OSX, that’s most likely libc++ headers. Try running:

clang++ -v -c -x c++ - < /dev/null