[LLVMbugs] [Bug 9618] New: Clang errors out reading cstddef

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sun Apr 3 12:05:26 PDT 2011


http://llvm.org/bugs/show_bug.cgi?id=9618

           Summary: Clang errors out reading cstddef
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: gagang at cs.wisc.edu
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


Created an attachment (id=6394)
 --> (http://llvm.org/bugs/attachment.cgi?id=6394)
Driver source code

I have written a Clang-based driver and implemented my own ASTconsumer.
When Clang parses the C++ input, it complains about cstddef, and generates the
following error message:

==
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
bug_test:
/afs/cs.wisc.edu/p/prometheus/private/gagan1/tools/llvm/llvm-src/tools/clang/lib/Frontend/TextDiagnosticPrinter.cpp:306:
void
clang::TextDiagnosticPrinter::EmitCaretDiagnostic(clang::Diagnostic::Level,
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 '('
Aborted

===

The error is also generated for older versions of cstddef (4.3.2, etc.).
I am using the latest Clang, LLVm from the trunk.

Included is the driver code and the C++ test input.
Clang and LLVm were installed using gcc-4.2.1.

Driver code was compiled using gcc-4.5.2, with the following options:

 g++ -I/p/prometheus/private/gagan1/tools/llvm/llvm-src/tools/clang/include
`/p/prometheus/private/gagan1/tools/llvm/install/bin/llvm-config --cxxflags`
-fno-rtti -c bug_test.cpp -O0 -g

Driver code was linked as follows:

g++ bug_test.o -o bug_test -lclang -lclangFrontendTool -lclangFrontend
-lclangIndex -lclangCodeGen -lclangDriver -lclangBasic -lclangLex -lclangParse
-lclangSema -lclangAnalysis -lclangAST -lclangRewrite -lclangSerialization
-lclangBasic `/p/prometheus/private/gagan1/tools/llvm/install/bin/llvm-config
--cxxflags --ldflags --libs` -g

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list