Clang 2.8 problems with 4.4.4. cstddef

I am using Clang 2.8 and trying to parse C++ code.
Clang is complaining about 4.4.4 cstddef. Error message is included below.

In file included from /usr/include/c++/4.4.4/cstdlib:43:
/usr/include/c++/4.4.4/cstddef:48:1: error: C++ requires a type specifier for all declarations
tutorial7: /afs/cs.wisc.edu/p/prometheus/private/gagan2/tools/llvm/llvm2.8.source/tools/clang/lib/Frontend/TextDiagnosticPrinter.cpp:298: void clang::TextDiagnosticPrinter::EmitCaretDiagnostic(clang::SourceLocation, clang::CharSourceRange*, unsigned int, const clang::SourceManager&, const clang::FixItHint*, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int): Assertion `LangOpts && "Unexpected diagnostic outside source file processing"' failed.
Stack dump:
0. /usr/include/c++/4.4.4/cstddef:48:25: current parser token '('

I would greatly appreciate any help with resolving the problem.
Thanks,
Gagan

Try upgrading to the soon to be released 2.9 or file a bug with a preprocessed source file.

Thanks!

-eric

2011/3/31 Gagan Gupta <gagang@cs.wisc.edu>

I am using Clang 2.8 and trying to parse C++ code.
Clang is complaining about 4.4.4 cstddef. Error message is included below.

In file included from /usr/include/c++/4.4.4/cstdlib:43:
/usr/include/c++/4.4.4/cstddef:48:1: error: C++ requires a type
specifier for all declarations
tutorial7:
/afs/cs.wisc.edu/p/prometheus/private/gagan2/tools/llvm/llvm2.8.source/tools/clang/lib/Frontend/TextDiagnosticPrinter.cpp:298:
void
clang::TextDiagnosticPrinter::EmitCaretDiagnostic(clang::SourceLocation,
clang::CharSourceRange*, unsigned int, const clang::SourceManager&,
const clang::FixItHint*, unsigned int, unsigned int, unsigned int,
unsigned int, unsigned int): Assertion `LangOpts && “Unexpected
diagnostic outside source file processing”’ failed.
Stack dump:
0. /usr/include/c++/4.4.4/cstddef:48:25: current parser token ‘(’

I would greatly appreciate any help with resolving the problem.
Thanks,
Gagan

It sounds like you are using the gcc-headers, which causes troubles within clang.
Try using clangs own headers by passing the “-resources ”-parameter to clang.
To see the correct resources-path, take your cpp-file and call
clang -###
on it - you will see the default arguments that clang would use to compile the file, the
resources-parameter should also be included.