Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

Clang crashes on "(!R.empty() && "empty lookup results when building templateid")" #12303

Open Quuxplusone opened 12 years ago

Quuxplusone commented 12 years ago
Bugzilla Link PR12187
Status CONFIRMED
Importance P enhancement
Reported by Alexander Potapenko (glider@google.com)
Reported on 2012-03-05 06:24:56 -0800
Last modified on 2019-01-24 17:49:39 -0800
Version trunk
Hardware PC Linux
CC dgregor@apple.com, llvm-bugs@lists.llvm.org, mail.sandbox.de@gmail.com, richard-llvm@metafoo.co.uk, rnk@google.com
Fixed by commit(s)
Attachments min.c (5872 bytes, text/x-csrc)
Blocks
Blocked by
See also
$ 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)
Quuxplusone commented 12 years ago
A minimal testcase:

=====================
namespace s{
r<;
b.; b.;
t<;
template<r>Ici(){}
b}
u;
template<>D(w)}
P(Ici<>(
=====================
$ clang++ -c b_u_c_l_u.ii

b_u_c_l_u.ii:2:1: error: unknown type name 'r'
r<;
^
b_u_c_l_u.ii:2:2: error: expected unqualified-id
r<;
 ^
b_u_c_l_u.ii:3:1: error: unknown type name 'b'
b.; b.;
^
b_u_c_l_u.ii:3:2: error: expected unqualified-id
b.; b.;
 ^
b_u_c_l_u.ii:3:5: error: unknown type name 'b'
b.; b.;
    ^
b_u_c_l_u.ii:3:6: error: expected unqualified-id
b.; b.;
     ^
b_u_c_l_u.ii:4:1: error: unknown type name 't'
t<;
^
b_u_c_l_u.ii:4:2: error: expected unqualified-id
t<;
 ^
b_u_c_l_u.ii:5:10: error: unknown type name 'r'
template<r>Ici(){}
         ^
b_u_c_l_u.ii:5:12: error: C++ requires a type specifier for all declarations
template<r>Ici(){}
           ^~~
b_u_c_l_u.ii:6:1: error: unknown type name 'b'
b}
^
b_u_c_l_u.ii:6:2: error: expected unqualified-id
b}
 ^
b_u_c_l_u.ii:7:1: error: C++ requires a type specifier for all declarations
u;
^
b_u_c_l_u.ii:8:11: error: C++ requires a type specifier for all declarations
template<>D(w)}
          ^
b_u_c_l_u.ii:8:1: error: extraneous 'template<>' in declaration of variable 'D'
template<>D(w)}
^~~~~~~~~~
b_u_c_l_u.ii:8:13: error: use of undeclared identifier 'w'
template<>D(w)}
            ^
b_u_c_l_u.ii:8:15: error: expected ';' at end of declaration
template<>D(w)}
              ^
              ;
b_u_c_l_u.ii:8:15: error: extraneous closing brace ('}')
b_u_c_l_u.ii:9:3: error: no template named 'Ici'; did you mean 's::Ici'?
P(Ici<>(
  ^~~
  s::Ici
b_u_c_l_u.ii:5:12: note: 's::Ici' declared here
template<r>Ici(){}
           ^
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             0x000000010160c372 PrintStackTrace(void*) + 34
1  clang             0x000000010160c8f9 SignalHandler(int) + 745
2  libSystem.B.dylib 0x00007fff848261ba _sigtramp + 26
3  clang             0x00000001004d8f01 (anonymous
namespace)::UnqualUsingDirectiveSet::addUsingDirectives(clang::DeclContext*,
clang::DeclContext*) + 77
4  clang             0x00000001000486e6 abort + 22
5  clang             0x0000000100048738 __assert_rtn + 56
6  clang             0x000000010053f2d2
clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*) + 222
7  clang             0x000000010046e62a
clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&,
clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*) + 2164
8  clang             0x00000001002e9637
clang::Parser::ParseCXXIdExpression(bool) + 241
9  clang             0x00000001002dcc3b
clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) + 7077
10 clang             0x00000001002d7cb5
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 133
11 clang             0x00000001002d8e18
clang::Parser::ParseExpressionList(llvm::SmallVectorImpl<clang::Expr*>&,
llvm::SmallVectorImpl<clang::SourceLocation>&, void
(clang::Sema::*)(clang::Scope*, clang::Expr*, llvm::ArrayRef<clang::Expr*>),
clang::Expr*) + 140
12 clang             0x00000001002bb1a2
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 1518
13 clang             0x00000001002c28e9
clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int,
bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1279
14 clang             0x000000010030b569
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 281
15 clang             0x000000010030ba42
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 396
16 clang             0x000000010030c9bc
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 3722
17 clang             0x000000010030cfce
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 262
18 clang             0x00000001002b5e95 clang::ParseAST(clang::Sema&, bool) +
325
19 clang             0x0000000100280ad3 clang::CodeGenAction::ExecuteAction() +
983
20 clang             0x000000010006a018
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 862
21 clang             0x000000010005279f
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2351
22 clang             0x000000010004c181 cc1_main(char const**, char const**,
char const*, void*) + 3185
23 clang             0x000000010004f7ed main + 621
24 clang             0x000000010004b4fc 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:9:8: 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.
Quuxplusone commented 12 years ago
The same error occurred to me today for this little test case:

-----------
#include <algorithm>    // <- needs to be included for this error
//#include <myalgo.hpp> // <- equal<T,U> lives here but accidentally not
included

int main()
{
    int x, y;
    equal(x, y); // error: use of undeclared identifier 'equal'
    equal<int, int>(x, y); // error: no template named 'equal'; did you mean
'std::equal'?

    return 0;
}

-----------
clang version 3.2 (trunk 167383)
Target: x86_64-unknown-linux-gnu
Thread model: posix
-----------
/usr/local/bin/clang-3.2 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -
disable-free -main-file-name bugNew.cpp -mrelocation-model static -fmath-errno -
masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64 -momit-
leaf-frame-pointer -O3 -std=c++0x -fdeprecated-macro -ferror-limit 1 -fmessage-
length 230 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -
fdiagnostics-show-option -fcolor-diagnostics -x c++ bugNew-DiIzad.cpp
---------

Both calls to "equal" are necessary for this crash to happen. If one of the
statements is commented out, the compiler properly complains about not finding
an appropriate function called equal.

----
clang-3.2: /home/xxx/Lib/llvm/tools/clang/lib/Sema/SemaTemplate.cpp:2291:
ExprResult clang::Sema::BuildTemplateIdExpr(const clang::CXXScopeSpec &,
clang::SourceLocation, clang::LookupResult &, bool, const
clang::TemplateArgumentListInfo *): Assertion `!R.empty() && "empty lookup
results when building templateid"' failed.
0  clang-3.2       0x000000000183fdae
1  clang-3.2       0x00000000018402aa
2  libpthread.so.0 0x00007f1696dc0cb0
3  libc.so.6       0x00007f1696216425 gsignal + 53
4  libc.so.6       0x00007f1696219b8b abort + 379
5  libc.so.6       0x00007f169620f0ee
6  libc.so.6       0x00007f169620f192
7  clang-3.2       0x000000000249bd4b
clang::Sema::BuildTemplateIdExpr(clang::CXXScopeSpec const&,
clang::SourceLocation, clang::LookupResult&, bool,
clang::TemplateArgumentListInfo const*) + 107
8  clang-3.2       0x00000000022e267a
clang::Sema::ActOnIdExpression(clang::Scope*, clang::CXXScopeSpec&,
clang::SourceLocation, clang::UnqualifiedId&, bool, bool,
clang::CorrectionCandidateCallback*) + 3066
9  clang-3.2       0x0000000001ca93ec clang::Parser::ParseCXXIdExpression(bool)
+ 460
10 clang-3.2       0x0000000001c9e6a4 clang::Parser::ParseCastExpression(bool,
bool, bool&, clang::Parser::TypeCastState) + 9940
11 clang-3.2       0x0000000001c9a5c3 clang::Parser::ParseCastExpression(bool,
bool, clang::Parser::TypeCastState) + 83
12 clang-3.2       0x0000000001c99428
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState) + 200
13 clang-3.2       0x0000000001c9932f
clang::Parser::ParseExpression(clang::Parser::TypeCastState) + 31
14 clang-3.2       0x0000000001cca07c clang::Parser::ParseExprStatement() + 60
15 clang-3.2       0x0000000001cc9786
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2070
16 clang-3.2       0x0000000001cc8e55
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 133
17 clang-3.2       0x0000000001ccfb35
clang::Parser::ParseCompoundStatementBody(bool) + 1477
18 clang-3.2       0x0000000001cd173a
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 282
19 clang-3.2       0x0000000001c5f2b7
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3751
20 clang-3.2       0x0000000001c749e3
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 467
21 clang-3.2       0x0000000001c5e3fd
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 1133
22 clang-3.2       0x0000000001c5dbd3
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 147
23 clang-3.2       0x0000000001c5d378
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 3384
24 clang-3.2       0x0000000001c5c602
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 466
25 clang-3.2       0x0000000001c58996 clang::ParseAST(clang::Sema&, bool, bool)
+ 550
26 clang-3.2       0x0000000001b49728 clang::ASTFrontendAction::ExecuteAction()
+ 312
27 clang-3.2       0x000000000187aa62 clang::CodeGenAction::ExecuteAction() +
1266
28 clang-3.2       0x0000000001b4933d clang::FrontendAction::Execute() + 237
29 clang-3.2       0x0000000001b22dcb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 779
30 clang-3.2       0x0000000001844bf7
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 999
31 clang-3.2       0x00000000007b40a8 cc1_main(char const**, char const**, char
const*, void*) + 760
32 clang-3.2       0x00000000007abf19 main + 473
33 libc.so.6       0x00007f169620176d __libc_start_main + 237
34 clang-3.2       0x00000000007abc01
Stack dump:
0.  Program arguments: /usr/local/bin/clang-3.2 -cc1 -triple x86_64-unknown-
linux-gnu -emit-obj -disable-free -main-file-name bugNew.cpp -mrelocation-model
static -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -target-
cpu x86-64 -momit-leaf-frame-pointer -resource-dir
/usr/local/bin/../lib/clang/3.2 -I ../../include -fmodule-cache-path
/var/tmp/clang-module-cache -internal-isystem /usr/lib/gcc/x86_64-linux-
gnu/4.6/../../../../include/c++/4.6 -internal-isystem /usr/lib/gcc/x86_64-linux-
gnu/4.6/../../../../include/c++/4.6/x86_64-linux-gnu -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.6/../../../../include/c++/4.6/backward -
internal-isystem /usr/local/include -internal-isystem
/usr/local/bin/../lib/clang/3.2/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-
externc-isystem /usr/include -O3 -std=c++0x -fdeprecated-macro -fdebug-
compilation-dir /home/xxx/Lib/aura/test/bugNew -ferror-limit 1 -fmessage-length
230 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -
fdiagnostics-show-option -fcolor-diagnostics -o /tmp/bugNew-hKMSzq.o -x c++
bugNew.cpp
1.  bugNew.cpp:9:17: current parser token '('
2.  bugNew.cpp:6:1: parsing function body 'main'
3.  bugNew.cpp:6:1: in compound statement ('{}')
Quuxplusone commented 11 years ago

Attached min.c (5872 bytes, text/x-csrc): Delta-minimized testcase.

Quuxplusone commented 5 years ago
Alexander's test cases no longer trigger the assertion for me, but this code
does, reduced from clang:

====
namespace a { template < class > b(class TypedefNameDeclType; c( const  ,     ;
}
g
}
struct : d::e<const> {
  g f;
  i(, ) {             h     *b< TypedefNameDecl >(
====

Compile with:
$ clang -cc1 t.cpp  -triple x86_64-linux-gnu -ferror-limit 19

It seems to be related to overrunning the error limit.