[LLVMbugs] [Bug 12187] New: Clang crashes on "(!R.empty() && "empty lookup results when building templateid")"

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Mar 5 04:24:56 PST 2012


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

             Bug #: 12187
           Summary: Clang crashes on "(!R.empty() && "empty lookup results
                    when building templateid")"
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: glider at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


$ cat b_u_c_l_u.ii
    namespace std {
            pair<typename      ;
              __base.setf(ios_base::boolalpha);
               __base.setf(ios_base::unitbuf);
            template<typename     class basic_iostream     : public
basic_istream<_CharT>   { };
          template<typename To>  To ImplicitCast_() {  }
          typedef bool_constant< ;
              };
               using namespace ::testing::internal2;
             template <> void DefaultPrintTo(IsContainer) {
         }
                        void PrintTo();
              PrintTo(ImplicitCast_<>());
=================================================
$ clang++ -c b_u_c_l_u.ii


b_u_c_l_u.ii:2:13: error: unknown type name 'pair'
            pair<typename      ;
            ^
b_u_c_l_u.ii:2:17: error: expected unqualified-id
            pair<typename      ;
                ^
b_u_c_l_u.ii:3:15: error: unknown type name '__base'
              __base.setf(ios_base::boolalpha);
              ^
b_u_c_l_u.ii:3:21: error: expected unqualified-id
              __base.setf(ios_base::boolalpha);
                    ^
b_u_c_l_u.ii:4:16: error: unknown type name '__base'
               __base.setf(ios_base::unitbuf);
               ^
b_u_c_l_u.ii:4:22: error: expected unqualified-id
               __base.setf(ios_base::unitbuf);
                     ^
b_u_c_l_u.ii:5:35: error: expected a qualified name after 'typename'
            template<typename     class basic_iostream     : public
basic_istream<_CharT>   { };
                                  ^
b_u_c_l_u.ii:5:35: error: expected ',' or '>' in template-parameter-list
b_u_c_l_u.ii:5:89: error: expected unqualified-id
            template<typename     class basic_iostream     : public
basic_istream<_CharT>   { };
                                                                               
        ^
b_u_c_l_u.ii:7:19: error: unknown type name 'bool_constant'
          typedef bool_constant< ;
                  ^
b_u_c_l_u.ii:7:32: error: expected unqualified-id
          typedef bool_constant< ;
                               ^
b_u_c_l_u.ii:9:34: error: no member named 'testing' in the global namespace
               using namespace ::testing::internal2;
                               ~~^
b_u_c_l_u.ii:9:43: error: expected namespace name
               using namespace ::testing::internal2;
                                          ^
b_u_c_l_u.ii:10:14: error: extraneous 'template<>' in declaration of variable
'DefaultPrintTo'
             template <> void DefaultPrintTo(IsContainer) {
             ^~~~~~~~~~~
b_u_c_l_u.ii:10:31: error: variable has incomplete type 'void'
             template <> void DefaultPrintTo(IsContainer) {
                              ^
b_u_c_l_u.ii:10:46: error: use of undeclared identifier 'IsContainer'
             template <> void DefaultPrintTo(IsContainer) {
                                             ^
b_u_c_l_u.ii:10:58: error: expected ';' at end of declaration
             template <> void DefaultPrintTo(IsContainer) {
                                                         ^
                                                         ;
b_u_c_l_u.ii:10:59: error: expected unqualified-id
             template <> void DefaultPrintTo(IsContainer) {
                                                          ^
b_u_c_l_u.ii:13:23: error: no template named 'ImplicitCast_'; did you mean
'std::ImplicitCast_'?
              PrintTo(ImplicitCast_<>());
                      ^~~~~~~~~~~~~
                      std::ImplicitCast_
b_u_c_l_u.ii:6:37: note: 'std::ImplicitCast_' declared here
          template<typename To>  To ImplicitCast_() {  }
                                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Assertion failed: (!R.empty() && "empty lookup results when building
templateid"), function BuildTemplateIdExpr, file
/Users/glider/src/asan/asan-llvm-trunk/llvm/tools/clang/lib/Sema/SemaTemplate.cpp,
line 2228.
0  clang             0x0000000101617242 PrintStackTrace(void*) + 34
1  clang             0x00000001016177c9 SignalHandler(int) + 745
2  libSystem.B.dylib 0x00007fff848261ba _sigtramp + 26
3  clang             0x00000001004d6931 (anonymous
namespace)::UnqualUsingDirectiveSet::addUsingDirectives(clang::DeclContext*,
clang::DeclContext*) + 77
4  clang             0x000000010004a586 abort + 22
5  clang             0x000000010004a5d8 __assert_rtn + 56
6  clang             0x000000010053c0b2
clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*) + 222
7  clang             0x000000010046f818
clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&,
clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*) + 2132
8  clang             0x00000001002ef827
clang::Parser::ParseCXXIdExpression(bool) + 241
9  clang             0x00000001002e32eb
clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) + 7077
10 clang             0x00000001002de895
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 133
11 clang             0x00000001002df4c8
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, void
(clang::Sema::*)(clang::Scope*, clang::Expr*, clang::Expr**, unsigned int),
clang::Expr*) + 140
12 clang             0x00000001002c3682
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 1518
13 clang             0x00000001002c9b09
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1279
14 clang             0x0000000100311096
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 278
15 clang             0x0000000100311572
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 396
16 clang             0x00000001003124dc
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3706
17 clang             0x0000000100312aee
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 262
18 clang             0x00000001002bd9b5 clang::ParseAST(clang::Sema&, bool) +
325
19 clang             0x0000000100289833 clang::CodeGenAction::ExecuteAction() +
983
20 clang             0x000000010006c2a8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 862
21 clang             0x00000001000543cf
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2351
22 clang             0x000000010004e021 cc1_main(char const**, char const**,
char const*, void*) + 3185
23 clang             0x000000010005141d main + 621
24 clang             0x000000010004d39c start + 52
Stack dump:
0.    Program arguments:
/Users/glider/src/asan/asan-llvm-trunk/llvm/build/Release+Asserts/bin/clang
-cc1 -triple x86_64-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free
-main-file-name b_u_c_l_u.ii -pic-level 1 -mdisable-fp-elim -masm-verbose
-munwind-tables -target-cpu core2 -coverage-file b_u_c_l_u.o -resource-dir
/Users/glider/src/asan/asan-llvm-trunk/llvm/build/Release+Asserts/bin/../lib/clang/3.1
-fdeprecated-macro -fdebug-compilation-dir
/Users/glider/src/chrome-make-asan/src -ferror-limit 19 -fmessage-length 179
-stack-protector 1 -mstackrealign -fblocks -fobjc-dispatch-method=mixed
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o
b_u_c_l_u.o -x c++-cpp-output b_u_c_l_u.ii 
1.    b_u_c_l_u.ii:13:38: current parser token '('
clang: error: unable to execute command: Illegal instruction
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang: note: diagnostic msg: Please submit a bug report to
http://llvm.org/bugs/ and include command line arguments and all diagnostic
information.
clang: note: diagnostic msg: Error generating preprocessed source(s) - no
preprocessable inputs.

This is true for ToT Clang and down to r151100 (I haven't tried further yet)

-- 
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