[LLVMbugs] [Bug 9024] New: "Missing default argument" assertion on invalid code.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 21 14:16:27 PST 2011


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

           Summary: "Missing default argument" assertion on invalid code.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: chris at bubblescope.net
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following invalid code:

template <class = int,int>  struct S {};
S<int> x;

Causes the following backtrace:

t.cc:1:26: error: template parameter missing a default argument
template <class = int,int> 
                         ^
t.cc:1:19: note: previous default template argument defined here                
template <class = int,int> 
                  ^
clang: SemaTemplate.cpp:2550: bool
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, const clang::TemplateArgumentListInfo&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&): Assertion `(Invalid ||
PartialTemplateArgs) && "Missing default argument"' failed.
0  clang           0x0000000002320b41
1  clang           0x0000000002320934
2  libpthread.so.0 0x00007fa09077d8f0
3  libc.so.6       0x00007fa08fa6ca75 gsignal + 53
4  libc.so.6       0x00007fa08fa705c0 abort + 384
5  libc.so.6       0x00007fa08fa65941 __assert_fail + 241
6  clang           0x000000000141a067
clang::Sema::CheckTemplateArgumentList(clang::TemplateDecl*,
clang::SourceLocation, clang::TemplateArgumentListInfo const&, bool,
llvm::SmallVectorImpl<clang::TemplateArgument>&) + 2023
7  clang           0x0000000001416c2b
clang::Sema::CheckTemplateIdType(clang::TemplateName, clang::SourceLocation,
clang::TemplateArgumentListInfo const&) + 201
8  clang           0x00000000014171d7
clang::Sema::ActOnTemplateIdType(clang::OpaquePtr<clang::TemplateName>,
clang::SourceLocation, clang::SourceLocation, clang::ASTTemplateArgsPtr,
clang::SourceLocation) + 167
9  clang           0x0000000001282164
clang::Parser::AnnotateTemplateIdTokenAsType(clang::CXXScopeSpec const*) + 280
10 clang           0x000000000125c463
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 3573
11 clang           0x00000000012536e3
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsingDeclSpec&,
clang::AccessSpecifier) + 93
12 clang           0x0000000001253b01
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&,
clang::AccessSpecifier) + 113
13 clang           0x0000000001253482
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::Parser::ParsingDeclSpec*) + 2170
14 clang           0x0000000001252b78
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 210
15 clang           0x000000000123c354 clang::ParseAST(clang::Sema&, bool) + 328
16 clang           0x0000000000fa9a19 clang::ASTFrontendAction::ExecuteAction()
+ 263
17 clang           0x00000000010e6e85 clang::CodeGenAction::ExecuteAction() +
951
18 clang           0x0000000000fa966a clang::FrontendAction::Execute() + 320
19 clang           0x0000000000f922bb
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 751
20 clang           0x0000000000f3f839
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 854
21 clang           0x0000000000f31b09 cc1_main(char const**, char const**, char
const*, void*) + 1032
22 clang           0x0000000000f3adf4 main + 499
23 libc.so.6       0x00007fa08fa57c4d __libc_start_main + 253
24 clang           0x0000000000f31179
Stack dump:
0.      Program arguments: /llvmdebug/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
t.cc -mrelocation-model static -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20.1 -resource-dir /llvmdebug/bin/../lib/clang/2.9 -ferror-limit 19
-fmessage-length 172 -fexceptions -fgnu-runtime -fdiagnostics-show-option
-fcolor-diagnostics -o t.o -x c++ t.cc 
1.      t.cc:4:1: at annotation token 
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal 1 (use -v to see
invocation)

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